How to select one image on montage and choose between the multiple images to select?
조회 수: 13 (최근 30일)
이전 댓글 표시
Hello everyone! How to select one image on montage and choose between the multiple images to select, please?It's my problem now! Please send me the code to my email please. Thanks. friedman.maharilaza@gmail.com
댓글 수: 0
답변 (1개)
Elisa
2025년 11월 28일 15:39
A little late for the person posting the question, but I had the same question and when unable to find a good answer, I wrote a small function to suit me. I'm sharing it for others to benefit. See the attached m-file.
Notes:
Create your montage adding a *single* pixel black border to each:
montageImage = montage(catImages,'Bordersize',[1 1]);
Pass this image into the function:
imgNum = selectMontage(montageImage)
The function will display the montage image in a new figure.
You will be prompted to select the subimage of interest by clicking with the mouse (ginput).
The number the subimage is in the sequence that formed the montage will be returned.
댓글 수: 3
Elisa
2025년 11월 29일 19:55
My solution may not solve all cases, and I think there was a gap as I converted what I was doing interactively into a function, but given that NOBODY had answered this question in 7 years and I didn't find anything else relevant online, it was offered to help people move forward a little. I found determining how many images wide vs tall were in the montage, and thus the element size, to be the most difficult part of solving the problem.
DGM
2025년 12월 3일 15:03
I appreciate that specific kind of motivation you mention. It's why I'm here. Had a problem, couldn't find anything in searches, wound up solving it in a days-long fit of madness, then went to find a place to testify.
I know that I often come across as a jerk, but sometimes the impression is more than intended. Apologies if that's what's happened. I suppose I have been too accustomed to barking at AI-generated slop answers these days, but being so reflexive is not fair in this case.
The utility is a start, but I want to offer ways to help you improve it, or if you consider it finished for your purposes, to help future readers make it work for them. Things like the example in the synopsis could easily lead someone into confusion. Explaining the different ways fixes could be approached seemed more illustrative than just writing my own complete answer and saying "no, use this".
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
