iPhoneのカメラを用いてリアルタイムで撮影した画像から文字認識を行い、画像を表示する
    4 views (last 30 days)
  
       Show older comments
    
前にご教授して頂いたときは、PCのカメラを使用して文字認識を行うというものでしたが、matlab mobileを用いてPCカメラで撮影するのではなくiPhoneカメラで撮影したいと考えています。


m = mobiledev;
cam = camera(m,'back');
videoFrame = snapshot(cam,'manual');
frameSize = size(videoFrame);
videoPlayer = vision.VideoPlayer('Position', [100 100 [frameSize(2), frameSize(1)]+30]);
runLoop = true;
while runLoop
    videoFrame = snapshot(cam);
    results = ocr(videoFrame);
    Ninshikimoji = lower(results.Words);
    Ninshikiwaku = results.WordBoundingBoxes;
    Jisho = readtable('allergy.xlsx','ReadRowNames',true);
    word = categorical(Jisho.word);
    Mininshiki = blanks(0);
    for n = 1:size(Ninshikimoji,1)
        if any(word == Ninshikimoji{n})
            Shoukai = Jisho{Ninshikimoji{n},:};
            videoFrame = insertObjectAnnotation(videoFrame,'rectangle',Ninshikiwaku(n,:),Shoukai{:},'font','Yu Gothic Bold');
            x = Ninshikiwaku(n,1); y = Ninshikiwaku(n,2); w = Ninshikiwaku(n,3); h = Ninshikiwaku(n,4);
            logo = imresize(imread([Shoukai{:} '.png']),0.3);
            videoFrame(y:(y+size(logo,1)-1),(x+w):(x+w+size(logo,2)-1),:) = logo;
        else
            Mininshiki = [Mininshiki ' ' Ninshikimoji{n}];
        end
    end
    step(videoPlayer, videoFrame);
    runLoop = isOpen(videoPlayer);
end
clear cam;
release(videoPlayer);
自分でできるのかをmatlab mobileでやってみたのですが、上記のプログラムで「このデバイスへの接続は、ワークスペースに既に存在します。」とエラーが出てしまいました。
今回、ご教授して頂きたい点は、エラーの解決方法とプログラムの添削となります。
ご教授の程よろしくお願いいたします。
0 Comments
Accepted Answer
  Kenta
      
 on 3 Oct 2021
        >このデバイスへの接続は、ワークスペースに既に存在します
とはすでにmobiledev objectが存在しているからで、単にclearと一番上にうてばよいとおもったのですが、いかがでしょうか
More Answers (0)
See Also
Categories
				Find more on MATLAB Mobile in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
