Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:28:00+00:00 2026-06-14T21:28:00+00:00

Hello StackOverflow Community, I’ve got a problem since two days with a larger image

  • 0

Hello StackOverflow Community,

I’ve got a problem since two days with a larger image and a ROI, which is part of the image.
I want to use imrect for selecting the ROI and cropping the ROI out, so that I have a smaller amount of data to process.
After processing I want to re-map the cropped image back to the original position of the image.

What I’ve done so far by debugging:

function paddedImg = putCroppedImgBack(croppedIm, Pos, origDim)
paddedImg = zeros(origDim);
r = round(Pos(1));
c = round(Pos(2));
if(r ==0) % because ML addresses a matrix not with 0 like in cpp
     r=1;
end
sizeR = size(croppedIm,1);
sizeC = size(croppedIm,2);
paddedImg(r:sizeR,c:sizeC) = croppedIm; %this part doesn't work!
%Subscripted assignment dimension mismatch.

I tried to round the coordinates of the imrect, but that didn’t worked aswell.
I also adressed manually paddedImg with the values, e.g.
paddedImg(1:5,20:50) = 1;, which works.

edit:
Found the solution after I started the post here…. sometimes I should ask StackOverflow a little bit earlier than spending a whole day with a sleepless night.

paddedImg(r:sizeR+r-1,c:sizeC+c-1) = croppedIm;

Sincerely

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:28:01+00:00Added an answer on June 14, 2026 at 9:28 pm

    edit: Found the solution after I started the post here…. sometimes I should ask StackOverflow a little bit earlier than spending a whole day with a sleepless night.

    paddedImg(r:sizeR+r-1,c:sizeC+c-1) = croppedIm;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello stackoverflow people! I've got a problem which I haven't been able to solve
Hello stackoverflow community. I do not want to draw each pictureBoxes image to Panel1
I want to say hello to the stackoverflow community. I've just started using knockout
Hello StackOverflow community, I have run into a problem that quite frankly is baffling
Hello stackoverflow Community, I am currently facing a problem with the jQuery mobile slider.
Hello StackOverflow community! I started to learn Node.js recently, and decided to implement a
Hello stackoverflow community ! I am trying to figure out how to architect my
Hello StackOverflow community, Using Google App Engine, I wrote a keyToSha256() method within a
Hello again, stackoverflow community! I'm working on writing a simple blog system in Rails,
Hello StackOverflow community, The air.swf file referenced here: http://livedocs.adobe.com/flex/3/html/help.html?content=distributing_apps_3.html used to launch AIR applications

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.