Warning while trying to filter RGB values on a picture

6 vues (au cours des 30 derniers jours)
Teshan Rezel
Teshan Rezel le 20 Déc 2019
Commenté : Zan Wang le 9 Juil 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

Réponse acceptée

Kaashyap Pappu
Kaashyap Pappu le 23 Déc 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 commentaires
Laura Velasquez
Laura Velasquez le 5 Fév 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 le 9 Juil 2021
I met the exact same error and your solution worked well. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by