Warning while trying to filter RGB values on a picture

5 ビュー (過去 30 日間)
Teshan Rezel
Teshan Rezel 2019 年 12 月 20 日
コメント済み: Zan Wang 2021 年 7 月 9 日
Hi All,
The following is my code:
I = imread('29_11_2019_132519Mosaix.jpg');
rmat = I(:,:,1);
gmat = I(:,:,2);
bmat = I(:,:,3);
binaryImageR = rmat < 50;
rmat(binaryImageR) = 0;
binaryImageG = gmat < 50;
gmat(binaryImageG) = 0;
binaryImageB = bmat < 50;
bmat(binaryImageB) = 0;
imageSum = (rmat & gmat & bmat);
figure;
subplot(2,3,1), imshow(binaryImageR);
title('Red Plane');
subplot(2,3,2), imshow(binaryImageG);
title('Green Plane');
subplot(2,3,3), imshow(binaryImageG);
title('Blue Plane');
subplot(2,3,4), imshow(imageSum);
title('Filter Sum');
subplot(2,3,5), imshow(I);
title('Original');
I get the following warning and am not certain of how to fix it.
Any help will be much appreciated!
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.editor.RegionEvaluator:
Error using getByteStreamFromArray
Error during serialization
Error in matlab.internal.editor.WorkspaceUtilities.serializeArray
Error in matlab.internal.editor.figure.SerializedFigureState/serialize
Error in matlab.internal.editor.FigureProxy/createWebFigureSnapshot
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.saveSnapshot
Error in matlab.internal.editor.FigureManager.snapshotAllFigures
Error in matlab.internal.editor.OutputsManager/postRegionCallback
Error in matlab.internal.editor.OutputsManager>@(varargin)obj.postRegionCallback(varargin{:})
Error in matlab.internal.editor.RegionEvaluator/postRegion
Error in matlab.internal.editor.RegionEvaluator>@(varargin)obj.postRegion(varargin{:})
Error in matlab.internal.editor.Evaluator/doPostEval
Error in matlab.internal.editor.Evaluator/evaluateCodeForFile
Error in matlab.internal.editor.RegionEvaluator/evaluateRegions
Error in matlab.internal.editor.evaluateRegions
Error in matlab.internal.editor.EvaluationOutputsService.evalRegions

採用された回答

Kaashyap Pappu
Kaashyap Pappu 2019 年 12 月 23 日
Assuming you are using the Live Editor, as a workaround, you can add the following command immediately after your plotting command(s):
>> uicontrol('Visible','off')
This will prevent the figure from being serialized, and hence most likely will prevent the error from occurring. Note, though, that this will cause the figure to then both be displayed in the Live Script and in a new figure window.
Hope this helps!
  2 件のコメント
Laura Velasquez
Laura Velasquez 2021 年 2 月 5 日
I had the same error and then I copied this code just bellow the plot function and it worked! thanks
Zan Wang
Zan Wang 2021 年 7 月 9 日
I met the exact same error and your solution worked well. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by