Borrar filtros
Borrar filtros

Creating code that will recognize colors on a plot.

4 visualizaciones (últimos 30 días)
Elijah Jones
Elijah Jones el 29 de Nov. de 2023
Editada: DGM el 29 de Nov. de 2023
I am trying to create a code that will register when there is no longer any white pixles and stop. I'm not sure if there is a function in matlab to scan a plot for a particular color but that is what I am looking for. Basically I would like to have it set up so that if it finds white on the plot nothing happens but once it no longer finds white it will increase a variable by 1.
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 29 de Nov. de 2023
Though I'm not sure what exactly you want to do, but one approach can be to save the plot as an image via exportgraphics, and scan the image accordingly.
Do you want get the number of non-white pixels in an image?
DGM
DGM el 29 de Nov. de 2023
Editada: DGM el 29 de Nov. de 2023
You've given a problem description which is simultaneously vague and seemingly contradictory. You have provided no concrete examples of the input image, nor have you even provided enough information to determine whether the input is a raster image at all. If you're trying to count pixels in an image of a plot, then I highly doubt that counting pixels is anything other than an XY problem, as the scale of exported figures is (effectively) arbitrary.
  • Explain the purpose of the exercise.
  • Provide an example of the expected input.
  • Provide an example of the expected output.
Try to make sure the things you write make sense to other people who can't read your mind.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 29 de Nov. de 2023
Simply use the Color Thresholder on the Apps tab of the tool ribbon. Use HSV or LAB color space. Adjust the sliders to segment out what you consider "white" to be. Then tell it to export the function. You'll get a mask of white pixels. To get a mask of non-white pixels, simply invert the mask. Or you can adjust the sliders to give you non-white pixels right away.

Categorías

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

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by