Warning while trying to filter RGB values on a picture

6 visualizaciones (últimos 30 días)
Teshan Rezel
Teshan Rezel el 20 de Dic. de 2019
Comentada: Zan Wang el 9 de Jul. de 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

Respuesta aceptada

Kaashyap Pappu
Kaashyap Pappu el 23 de Dic. de 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 comentarios
Laura Velasquez
Laura Velasquez el 5 de Feb. de 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 el 9 de Jul. de 2021
I met the exact same error and your solution worked well. Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by