Warning while trying to filter RGB values on a picture

5 次查看(过去 30 天)
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 个)

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by