Warning while trying to filter RGB values on a picture

6 Ansichten (letzte 30 Tage)
Teshan Rezel
Teshan Rezel am 20 Dez. 2019
Kommentiert: Zan Wang am 9 Jul. 2021
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

Akzeptierte Antwort

Kaashyap Pappu
Kaashyap Pappu am 23 Dez. 2019
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 Kommentare
Laura Velasquez
Laura Velasquez am 5 Feb. 2021
I had the same error and then I copied this code just bellow the plot function and it worked! thanks
Zan Wang
Zan Wang am 9 Jul. 2021
I met the exact same error and your solution worked well. Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by