You can use the imcrop and imwrite functions in MATLAB to achieve this. Here's an example code that takes a rectangular subset of the image and pastes it into another position in the same image:
main.m532 chars22 lines
Make sure to replace 'image.jpg' with the filepath to your image. The code above crops a rectangular subset of size 200x250 pixels from (x=50, y=100) in the image and pastes it into (pasteX=300, pasteY=200). The modified image is then saved as 'modified_image.jpg'. Adjust the values of x, y, width, height, pasteX, and pasteY according to your requirements.
gistlibby LogSnag