Hi!
I'm writing a multiwindow app to segment image based on the rgb profile.
App1, App2 and an example of the image used is attached.
App1 is composed of two push buttons: "Load image" and "Threshold". When the "Load image" button is pressed, it executes some code to load image from a folder. When the "Threshold" button is pressed, it opens a new window, called app2, that contains multiple parts:
5 UIAxes ==> Original image, Mask image, Red channel, Green channel and Blue channel
3 push buttons ==> Import original image and histogram, close App2 and Apply RGB values
6 spinners used to adjust low and high red, green and blue levels used to binarize the image
When the "import original image and histogram" is pushed, it loads the image from App1 and displays it in "Original image" and "Mask image" UIAxes. It also load and display in "red channel", "green channel" and "blue channel" the histogram distribution of red, green and blue layers.
Then, and it is where I have the problem, when i select a specific min or max value with the spinners and hit the "Apply RGB values" button, I got the following error message in the command window:
Error using >=
Arrays have incompatible sizes for this operation.
Error in app2/ApplyRGBvaluesButtonPushed (line 114)
spinnerBW = (I(:,:,1) >= app.minRedValue) & (I(:,:,1) <= app.maxRedValue) ...
Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)
newCallback = @(source, event)executeCallback(appdesigner.internal.service.AppManagementService.instance(), ...
Related documentation
Error while evaluating Button PrivateButtonPushedFcn.
I have already this bit of code in a script that works like a charm.
Any help on solving this error would be greatly appreciated.
Best,
Guillaume