Downsampling a single RGB Channel
이전 댓글 표시
How would you go about downsampling a single RGB Channel (R, G or B) and then re-forming the RGB image? I'm fairly new to image processing. I've looked at a few sources, but I haven't managed to find the answer to this in Matlab yet.
For example, if I split the image into its individual R, G and B channels, downsample the G and B channel with sample rate of 2, how would I recombine the R channel with the downsampled G and B channels? They are all now different matrix dimensions. I hope this isn't a silly question and that my example is clear enough to understand.
답변 (1개)
Image Analyst
2016년 4월 20일
Use cat
smallRGB = cat(3, smallRedChannel, smallGreenChannel, smallBlueChannel);
Of course you can use use imresize(rgbImage, 0.5) on the original RGB image if you want, rather than splitting it up into separate color channels.
댓글 수: 4
stayfrosty
2016년 4월 20일
편집: stayfrosty
2016년 4월 20일
Image Analyst
2016년 4월 20일
That's correct, they can't be combined unless they're all the same size. If you want, you can blow up the small images with pixel replication using the 'nearest' option of imresize(). Then you can recombine them and see two of the channels looking kind of blocky.
stayfrosty
2016년 4월 20일
편집: stayfrosty
2016년 4월 20일
Image Analyst
2016년 4월 20일
Notice that they do not combine the different sized images into another image like you asked about. They probably save them separately in binary in some file, one after the other.
To reconstruct, yes, you'd read in the data, then reverse the process, including IDCT and resizing.
카테고리
도움말 센터 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!