MATLAB Answers

specific image stretching to chosen size

조회 수: 5(최근 30일)
Neil Rooze
Neil Rooze 2020년 3월 12일
답변: Pranjal Kaura 2021년 7월 30일
How do i strech the 4th image so that only the RGB part is 300 x 300. i want the black bit deleted.
  댓글 수: 2
Neil Rooze
Neil Rooze 2020년 3월 13일
The last picture i want to stretch it like in the picture below. so it is a perfect square. (the read arrows are the stretching direction until it reaches the marked square)
thank you.

댓글을 달려면 로그인하십시오.

답변(1개)

Pranjal Kaura
Pranjal Kaura 2021년 7월 30일
Hey Neil,
It is my understanding that you want to rescale(stretch) the 4th image such that only a selected portion (RGB part of the image) is displayed on the predefined axis.
A possible workaround could be:
  • Accessing the 4th location in the plot by using the subplot function. For your example you can use "subplot(1, 4, 4)" to access the 4th location.
  • Rescaling the image by changing the 'Xdata' and 'Ydata' property of the 'imshow' function.
  • Use the 'imcrop' function to crop out the required part of the image.

Community Treasure Hunt

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

Start Hunting!

Translated by