Results 1 to 20 of 25

Thread: QImage::scaled cause "raster"/"grid"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QImage::scaled cause "raster"/"grid"

    Please don't start multiple threads on the same subject. Threads merged.

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: QImage::scaled cause "raster"/"grid"

    So the problem is your camera :]
    The most important part of image processing is image acquisition. Even the best algorithms can't help you if the image quality is poor. And I don't mean only resolution, but also colors, lights which means generaly a quality of the whole scene you make a picture of. Next thing is that the light sensitive matrix (or how the hell is it called in english) in your camera is not the one that will give you the quality you want (generally those megapixels are some kind of cheat because 1 pixel can measure only 1 color (red, gree, blue) so to have color pixels camera needs 2x2 square where it takes 2 green pixels, 1 red, 1 blue and uses interpolation to get RGB values of each pixel).

    So what you can do is a technique which was advised on Qt Labs: if you want to scale some image to for example a little bit less than 1/2 of original resolution, then scale it to 1/2 (which is fast and nice for an obvous reasons :] - take every second row and then every second pixel in thise rows) with a fast transformation and then use smooth transformation to get the final ratio.

  3. #3
    Join Date
    May 2008
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage::scaled cause "raster"/"grid"

    I you scale down an image without smoothing you may have aliasing (see image processing theory) and the grid I see on images makes me think you have aliasing !
    The more your original image has noise, the more aliasing could be a problem. Try to smooth (filter) the image before scaling.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QImage::scaled cause "raster"/"grid"

    Quote Originally Posted by ness View Post
    I you scale down an image without smoothing you may have aliasing (see image processing theory) and the grid I see on images makes me think you have aliasing !
    The more your original image has noise, the more aliasing could be a problem. Try to smooth (filter) the image before scaling.
    I don't think so. Aliasing can only occur in diagonal directions. What we see here looks more like interlace or something like that. If you scale by 1/2, 1/4, etc. the interlace will go away because all the "interlaced" lines will be discarded. Where the interlace-like effect comes from? I have no idea, probably the data aquisition process was incorrect (format conversion can be treated as part of the aquisition as well). If QImage::scaled() was not working, the effect would be noticable on the whole area of the photo and not only in some special conditions.

  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: QImage::scaled cause "raster"/"grid"

    o... didn't check your previous code but I see thats the thing I mentioned above with those cameras :] but didn't think you have to do it by yourself ;]

  6. #6
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: QImage::scaled cause "raster"/"grid"

    this problem is true for my other camera chips, like ov5620 which producted by OV ..
    Last edited by wesley; 20th April 2010 at 11:02.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QImage::scaled cause "raster"/"grid"

    Can you replicate it with some arbitrary image downloaded from the Web?

  8. #8
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: QImage::scaled cause "raster"/"grid"

    Quote Originally Posted by wysota View Post
    Can you replicate it with some arbitrary image downloaded from the Web?
    No, i tried to load the image got from web into a QImage, then scale and display it, There is not the "raster" problem.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QImage::scaled cause "raster"/"grid"

    But did you do the same conversion you have been doing for your image?

  10. #10
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: QImage::scaled cause "raster"/"grid"

    Quote Originally Posted by wysota View Post
    But did you do the same conversion you have been doing for your image?
    no, because the conversion is used to convert a raw image data to RGB data, but the web image is already RGB (load with QImage)

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QImage::scaled cause "raster"/"grid"

    Well, obviously QImage::scaled() works in general so you don't have to check that. Find a raw image, convert it using your routine (to test your routine) and then pass it through QImage::scaled() to see if you obtain a similar effect.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 8th July 2008, 20:37
  2. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05
  3. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 16:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.