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.
Create image matrix by choosing pixels interactively.
8 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!