How to improve quality of resized images?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 9 Mag 2023
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.
Risposte (1)
Priyank Pandey
il 15 Mag 2023
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
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!