How to improve quality of resized images?
7 次查看(过去 30 天)
显示 更早的评论
Hello, I made object detector using faster r-cnn ... i resized images from 1920x1080 to input size [224 224 3]... but after running detector on test image, image looks so bad :
How to improve quality of the image ?
Here is the code where i am running detector on test image :
I = imread(testDataTbl.imageFilename{84});
I = imresize(I,inputSize(1:2));
[bboxes,scores] = detect(detector,I);
I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
figure
imshow(I)
1 个评论
Walter Roberson
2023-5-9
You could try using a method option for the imresize()...
but rerducing an image by a factor of 8 1/2 in one direction and 4 3/4 in a different direction is going to reduce detail to only about 2.5% of the original, and is going to distort aspect ratios. You should not expect it to get "good" results.
回答(1 个)
Priyank Pandey
2023-5-15
Hi Adrian,
As I can see you're using the imresize function to resize the image to the desired input size. However, this function may introduce artifacts and distortions in the image, which can affect the accuracy of the object detection. To avoid this, you can try using a different resizing method, such as bicubic interpolation, which can provide a smoother and more accurate image.
Here's an example how you can modify the code:
I = imread(testDataTbl.imageFilename{84});
I = imresize(I,[inputSize(1) NaN]);
I = imresize(I,[NaN inputSize(2)]);
[bboxes,scores] = detect(detector,I);
I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
figure
imshow(
I)
In this code, we first resize the image to the desired height using imresize(I,[inputSize(1) NaN]), then we resize it to the desired width using imresize(I,[NaN inputSize(2)]). This way, we avoid introducing artifacts and distortions in the image, which can improve the quality of the output.
I hope this helps.
Regards
Priyank
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!