imfreehand/impoly using different color other than blue

3 visualizaciones (últimos 30 días)
Noam Weissman
Noam Weissman el 12 de Jul. de 2016
Respondida: Naga el 11 de Feb. de 2025
while i'm using imfreehand or impoly I want to change the color of the line from the beginning (I know how to change it after that I have finished the creation of the line/polygon).

Respuestas (1)

Naga
Naga el 11 de Feb. de 2025
Starting from MATLAB R2018b, the 'imfreehand' function is not recommended, and MATLAB introduced a new set of ROI (Region of Interest) objects that offer more functionality and flexibility, including the ability to set the color of the ROI from the beginning.
To create a freehand ROI with a specific color, you can use the 'drawfreehand function', which is part of the new ROI framework. Here’s an example of how you can create a freehand ROI with a red color:
% Display the image
imshow('image.png');
% Create a freehand ROI with a specified color
h = drawfreehand('Color', 'r'); % 'r' is for red, you can use other colors like 'g', 'b', etc.
Switching to these new ROI objects will allow you to take advantage of additional capabilities, such as face color transparency and event handling.
For more detailed information, you can refer to the official MATLAB documentation on the 'drawfreehand' function: https://www.mathworks.com/help/images/ref/drawfreehand.html

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by