Is it possible to resize image without changing its total number of pixels?
古いコメントを表示
I want to reduce each pixel size upto 0.5 but I want the total number of pixels to be the same. Is this possible ?. Kindly Advise.
4 件のコメント
Rik
2022 年 4 月 19 日
It sounds like you misunderstood the concept of a pixel. A pixel has a unit size. You can resize the image to half the size, but not a pixel. What do you envision the result to be?
Adam Danz
2022 年 4 月 19 日
If the goal is to show the image in MATLAB, you can specify the x and y values and use the same intensity/RGB data. This way you can scale the image and maintain the number of image pixels.
Abdul Hannan Qureshi
2022 年 4 月 19 日
Abdul Hannan Qureshi
2022 年 4 月 19 日
採用された回答
その他の回答 (1 件)
Maybe something like:
A = imread('cameraman.tif');
[h w] = size(A); % [256 256]
imshow(A,'xdata',[1 w]/2,'ydata',[1 h]/2)
hold on
plot(64,64,'yo','linewidth',2) % just for demonstration
Note that while the image is still 256x256, the image is plotted on a half-size grid. The NW pixel is now at [0.5 0.5] instead of [1 1], and the center of the image is now at [64 64]. The same can be done with image()/imagesc(). I can't really demonstrate imdistline() in the forum editor, but you should be able to use it just fine.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
