2022年11月5日 星期六

Google DriveToWeb jpg file blocked by CORS policy

Demo link

https://aframe-gallery.glitch.me/

Description information

https://aframe.io/docs/1.3.0/guides/building-a-360-image-gallery.html

1. Copy example into drivetoweb @ Google

2. Replace https://cdn.aframe.io/360-image-gallery-boilerplate/img/city.jpg by local jpg file

3. CORS error

Access to fetch at 'https://drive.google.com/uc?id=1axbPxNB1yL-tdZbKyt__jbjrFYSphzRm' (redirected from 'https://uezbafchzoobug0w05g98q.on.drv.tw/www.092012a.io/GT1.jpg') from origin 'https://uezbafchzoobug0w05g98q.on.drv.tw' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

4. Reduce the size of jpg file (from 4M to 122K).

5. OK



2022年10月25日 星期二

esp32-cam vehicle

 Ref: https://randomnerdtutorials.com/esp32-cam-car-robot-web-server/

1. ASUS X450J @ Windows 10 x64

2. esp32-cam vehicle from

https://shopee.tw/可手機操控及影像顯示的四輪自走車套件 已裝程式及提供原始碼-全套件含ESP32CAM開發板及電池與電機小車4輪底盤-i.4491023.9451496001

3. Download arduino ide

4. Upload Code to ESP32-CAM AI-Thinker (Arduino IDE)

https://randomnerdtutorials.com/program-upload-code-esp32-cam/

5. After uploading, open the Serial Monitor to get its IP address.

6. 移除GPIO0 接地線

7. Reset 

8. 電腦(手機)瀏覽器 http://192.168.1.131 (Serial monitor 回傳ip)






2022年8月17日 星期三

embeded vlc streaming play

 Ref-https://www.cnblogs.com/cplemom/p/13956092.html

WPF app + embedded vlc players

1. new wpf project   framework 4.7.2

2. add nuget package

Install-Package Vlc.DotNet.Wpf -Version 3.1.0

Vlc.DotNet.Core

Vlc.DotNet.Core.Interops

Vlc.DotNet.Wpf

3. xmal file ; add xmlns 

 xmlns:v="clr-namespace:Vlc.DotNet.Wpf;assembly=Vlc.DotNet.Wpf"

4. xaml file add 2 VlcControl

<Grid x:Name="g1" >

        <Grid>

            <v:VlcControl Name="vlcControl1" Margin="427,0,0,0"/>

        </Grid>

        <Grid>

            <v:VlcControl Name="vlcControl2" Margin="0,0,413,0"/>

        </Grid>

    </Grid>

5. xaml.cs file x64 vlcplay 

InitializeComponent();

string VLCPath = @"C:\Program Files\VideoLAN\VLC";

vlcControl1.SourceProvider.CreatePlayer(new System.IO.DirectoryInfo(VLCPath));

string url = @"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_30MB.mp4";

if (!string.IsNullOrWhiteSpace(url))

{

      vlcControl1.SourceProvider.MediaPlayer.Play(new Uri(url));

}

vlcControl2.SourceProvider.CreatePlayer(new System.IO.DirectoryInfo(VLCPath));

string url2 = @"rtmp://192.168.1.102/stream/passingcode";

            if (!string.IsNullOrWhiteSpace(url2))

            {

                vlcControl2.SourceProvider.MediaPlayer.Play(new Uri(url2));

            }

5. Select x64 mode 

6. excute rtmp://192.168.1.102/stream/passingcode

7. run

8.Result :

2021年11月7日 星期日

julia test (I)

 REF: https://julialang.org/downloads/

julia-1.6.3-win64.exe

Add julia path

Hello world

1) interactive hello world (println)

2) Create ex1.jl

copy con ex1.jl

println("hello world.")

ctrl+z

julia ex1.jl






2021年5月5日 星期三

License_Plate_Recognition_in_CSharp

 REF:

1)https://www.emgu.com/wiki/index.php/License_Plate_Recognition_in_CSharp

2)https://github.com/fasetto/license-plate-recognition/blob/master/src/LPlateRecognition.UI/ViewModels/MainViewModel.cs

Windows 10 x64 @ ASUS X450

Visual Studio 2019

建置程序

1) New FormApp

2) Nuget 

emgu.cv 3.4.3.3016

Tesseract.Net SDK 1.18.342

3) Add class (Ref:1)

using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.OCR;
using Emgu.CV.Structure;
using Emgu.CV.Util;
using Emgu.Util;
using Patagames.Ocr;
using Patagames.Ocr.Enums;
//---###
using (UMat tmp = filteredPlate.Clone())
       {
          string plainText;
          using (var api = OcrApi.Create())
          {
            api.Init(Languages.English);
            api.SetVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZ-1234567890");
            plainText = api.GetTextFromImage(tmp.Bitmap);
           }
           //_ocr.Recognize(tmp);
          //words = _ocr.GetCharacters();
                                //if (words.Length == 0) continue;
                                if (plainText.Length == 0) continue;
                                //for (int i = 0; i < words.Length; i++)
                                for (int i = 0; i < plainText.Length; i++)
                                {
                                    strBuilder.Append(plainText[i]);
                                }
                            }
//---###
4) Form1.cs
public Form1()
        {
            InitializeComponent();
            imageBox1.Image = new Image<Bgr, byte>(@"C:\Users\csjou\Downloads\license-plate2.jpg");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            LicensePlateDetector LPD = new LicensePlateDetector("test");
            Mat m = new Image<Bgr, byte>(imageBox1.Image.Bitmap).Mat;
            List<IInputOutputArray> licensePlateImagesList = new List<IInputOutputArray>();
            List<IInputOutputArray> filteredLicensePlateImagesList = new List<IInputOutputArray>();
            List<RotatedRect> licenseBoxList = new List<RotatedRect>();
            List<string> words = LPD.DetectLicensePlate(
            m,
            licensePlateImagesList,
            filteredLicensePlateImagesList,
            licenseBoxList
            );
            this.Text = "";
            for (int i = 0; i < words.Count; i++)
                this.Text += words[i];
        }



emgu 轉換

 REF: http://ferris2014.blogspot.com/2016/06/opencv-emgu-mat-to-image-image-to-mat.html

Mat to image, image to Mat, image to imagebox, imagebox to image, Mat to imagebox, imagebox to Mat

1. Mat to image

_img = _mat.ToImage<bgr, Byte>();

2. image to Mat

_mat = _img.Mat;

3. image to imagebox

imagebox1.Image=_img;

4. imagebox to image

_img = new Image<bgr, byte>(imageBox1.Image.Bitmap)

5. Mat to imagebox

imagebox1.Image=_mat;

6. imagebox to Mat

(Step4 + Step2)

_img= new Image<bgr, byte>(imageBox1.Image.Bitmap).Mat;

2021年1月26日 星期二

CMake 入門/簡單的範例 (Windows 10)

REF: https://zh.m.wikibooks.org/zh-tw/CMake 入門/簡單的範例

1. Windows 10 x64 @ ASUS X450J

2. Prepare files 

3. cd D:\Course1092\AI1092\cmakes\ex2/src
4. cmake --build .

5. cd Debug
6. ./ex2.exe