Resize image to a square centred on a certain pixel
Mostrar comentarios más antiguos
Hi,
I have a camera that captures images with a size of 960 by 1280 pixels. I wanted to resize this image so that it is squared on the pixel of highest value, and has dimensions of 960 by 960. Could anyone suggest any codes to achieve this? The image format I am using is .bmp if that helps.
Thanks
Harry
2 comentarios
David Young
el 9 de Mzo. de 2015
Editada: David Young
el 9 de Mzo. de 2015
It will help with making a good answer if you could clarify a couple of points.
- What do you mean by highest value? Presumably your image is a colour image, so each pixel has r, g and b values. Do you mean the pixel that has the highest sum, r+b+g, or the highest g, or some other measure?
- What do you want to do about the fact that the square will go outside the original image? That is, suppose the pixel with the highest value is at x=100, y=100. A square centred on this will have a corner at x=-330, y=-330. Do you want to fill the undefined pixels with zeros or something, or resample the image so that a 960x960 square fits in, or something else?
By the way, it doesn't matter how your image is stored on disk. You just use imread to read it into an array in main memory and work on that.
Harry Cantor
el 9 de Mzo. de 2015
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Read, Write, and Modify Image en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!