Create image matrix by choosing pixels interactively.

3 visualizaciones (últimos 30 días)
David Epstein
David Epstein el 31 de Ag. de 2018
Respondida: David Epstein el 1 de Sept. de 2018
Given a positive integer n (say n=50), I want to make an n x n white box with black boundary, and black grid lines, dividing it up into conceptual pixels. Then I want to click inside "pixels" that I select. The pixel should then turn grey (so that the grid lines remain visible), and an n x n image matrix should be created with the white "pixels" giving a 1 and the grey pixels giving 0 or 0.5 (I don't care which). I would be grateful for hints on how to do this. I tried roipoly but didn't succeed.
What I really want is the matrix, and I would be happy with any easy interactive method to create it. The whole point is that I need to see the image, while I'm creating the matrix. I'm sure I could do this, though it might take me a lot of time to figure out how without help. I'm looking for an easy way to code it.

Respuesta aceptada

David Epstein
David Epstein el 1 de Sept. de 2018
I solved this using a Matlab plot with ginput in a loop collecting one click each time it went through the loop. This built up the interactive image. The graphics matrix was built up at the same time, but was not used to construct the figure I was creating.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by