Borrar filtros
Borrar filtros

How to improve quality of resized images?

2 visualizaciones (últimos 30 días)
Adrian Kleffler
Adrian Kleffler el 9 de Mayo de 2023
Comentada: Adrian Kleffler el 15 de Mayo de 2023
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 comentario
Walter Roberson
Walter Roberson el 9 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (1)

Priyank Pandey
Priyank Pandey el 15 de Mayo de 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
  1 comentario
Adrian Kleffler
Adrian Kleffler el 15 de Mayo de 2023
Hi, after trying your code this error appeared:
Error using vision.internal.cnn.validation.checkDetectionInputImage
Input image size must be greater than [224 224]. The minimum input image size must be equal to or greater than the input size in image input layer of the network.
Error in fasterRCNNObjectDetector/parseDetectInputs (line 735)
[sz,params.DetectionInputWasBatchOfImages] = vision.internal.cnn.validation.checkDetectionInputImage(...
Error in fasterRCNNObjectDetector/detect (line 523)
params = this.parseDetectInputs(I, varargin{:});

Iniciar sesión para comentar.

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by