필터 지우기
필터 지우기

How to improve quality of resized images?

조회 수: 2 (최근 30일)
Adrian Kleffler
Adrian Kleffler 2023년 5월 9일
댓글: Adrian Kleffler 2023년 5월 15일
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
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
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
  댓글 수: 1
Adrian Kleffler
Adrian Kleffler 2023년 5월 15일
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{:});

댓글을 달려면 로그인하십시오.

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by