CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2009
    Posts
    112

    Increase picture quality

    Hi, Let me just say this before I get to my question:

    I bought a Logitech C910 HD webcam that is advertised to take 10MP images with the help from additional software. So the webcam is actually a 2MP camera, but they somehow make it a 10MP picture. I did this and the picture looks very nice.


    Now on to my question:

    I'm working on an application that takes a picture using the webcam using DirectShow. This works all good and well, but the image quality is lacking a little bit. It's still pretty good with the 2MP camera, but I would really like it to be better. Is there any way I can do what the Logitech software does in C# once I take picture with my webcam? not necessarily 10MP but something better...

    Thanks.
    - It's a long way to the top if you want to rock n' roll - AC/DC

    Check out my band and support the music:
    www.blueruinmusic.com

  2. #2
    Join Date
    Aug 2011
    Posts
    5

    Re: Increase picture quality

    Likely:

    1. The native resolution of the camera is higher.
    Consumers recognize things like "1080p," so it isn't uncommon for manufacturers to use only part of the image to make the video output a format customers expect. The benefit here is you can stream this to a TV. The downside is you are losing part of the frame.

    CCD sensors aren't even made in a 1080p format. The closest size I can find is 2012x1324 (~2.7mp)

    2. The software is using superresolution from multiple frames
    2012x1324 *4 = ~10mp.

    You can find algorithms (and maybe even code) to perform this step on the internet. The main thing here is it requires multiple frames and may take a second or two to compute, so that's why it is useful for still shots and not video.

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Increase picture quality

    hmm. To the best of my knowledge a 2mp picture is a 2mp picture. Turning it into 10 mp would require many pixels added that were not there before. What format is direct show getting the image in?
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Feb 2009
    Posts
    112

    Re: Increase picture quality

    well actually I'm just taking a screenshot of the video feed. and that is "Format32bppArgb"
    - It's a long way to the top if you want to rock n' roll - AC/DC

    Check out my band and support the music:
    www.blueruinmusic.com

  5. #5
    Join Date
    Aug 2011
    Posts
    5

    Re: Increase picture quality

    Your best bet would be to acquire a sequence of raw images (GR/BG format) and process them manually. Processing screenshots of the already demosaic'd data won't yield great results.

  6. #6
    Join Date
    Feb 2009
    Posts
    112

    Re: Increase picture quality

    Quote Originally Posted by elrabin View Post
    Likely:

    1. The native resolution of the camera is higher.
    Consumers recognize things like "1080p," so it isn't uncommon for manufacturers to use only part of the image to make the video output a format customers expect. The benefit here is you can stream this to a TV. The downside is you are losing part of the frame.

    CCD sensors aren't even made in a 1080p format. The closest size I can find is 2012x1324 (~2.7mp)

    2. The software is using superresolution from multiple frames
    2012x1324 *4 = ~10mp.

    You can find algorithms (and maybe even code) to perform this step on the internet. The main thing here is it requires multiple frames and may take a second or two to compute, so that's why it is useful for still shots and not video.
    That is some interesting stuff. I actually found a different project that works a little better, and I think that may help me out. The project I found is called dxSnap, and it is a sample from the DirectShow.NET Library (http://sourceforge.net/projects/directshownet/files/) that works with my webcam, and it allows me to take 2592x1944 images. so that might be enough to make this project work. We'll see, if not I'll probably be looking for some help with superresolution. Anyway I'm now running into the issue where I take the picture and it creates the bitmap no problem, but when I go to save it as a file, it throws a generic GDI+ error. I have no idea what is causing this. I've saved bitmaps many-a-time and never did this. Here is the code I use:

    Code:
                Cursor.Current = Cursors.WaitCursor;
    
                // Release any previous buffer
                if (m_ip != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(m_ip);
                    m_ip = IntPtr.Zero;
                }
    
                // capture image
                m_ip = cam.Click();
                Bitmap b = new Bitmap(cam.Width, cam.Height, cam.Stride, PixelFormat.Format24bppRgb, m_ip);
                b.Save("c:\\test.png", ImageFormat.Png); //<--This is where is bombs out
                
                // If the image is upsidedown
                b.RotateFlip(RotateFlipType.RotateNoneFlipY);
                pictureBox1.Image = b;
    
                Cursor.Current = Cursors.Default;
    **UPDATE**
    Nevermind I figured out what was wrong, I guess saving it to the root of the C drive was making the application unhappy. Once I changed the location to the Desktop it worked wonderfully.
    Last edited by vandel212; August 25th, 2011 at 08:33 PM.
    - It's a long way to the top if you want to rock n' roll - AC/DC

    Check out my band and support the music:
    www.blueruinmusic.com

  7. #7
    Join Date
    Aug 2008
    Posts
    902

    Re: Increase picture quality

    It's no secret that companies will intentionally mislead or out right lie through their teeth about their product, especially when numbers are involved. The average consumers are idiots when it comes to technology, and the only thing they know is that bigger is better. So the large the numbers are on their packaging, the more likely they are going to get to your money. You'd be surprised at how many products mislead or plain lie about their specs. If you are smart enough to read the asterisks you usually don't have to look any further than the box to know they are simply trying to one up the product next to theirs by artificially inflating their specs.

    No amount of interpolation is going to increase the quality of your images. You can't turn a 2 megapixel image into a 10 megapixel image. Simple as that. To do so would essentially break the second law of thermodynamics. Sorry, but nobody is above the law.

  8. #8
    Join Date
    Aug 2011
    Posts
    5

    Re: Increase picture quality

    Quote Originally Posted by Chris_F View Post
    No amount of interpolation is going to increase the quality of your images. You can't turn a 2 megapixel image into a 10 megapixel image. Simple as that. To do so would essentially break the second law of thermodynamics. Sorry, but nobody is above the law.
    Actually, it's easy to make a 2MP image into a 10MP image. Just add on 8 million black pixels around your source image. Done!

  9. #9
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: Increase picture quality

    Quote Originally Posted by elrabin View Post
    Actually, it's easy to make a 2MP image into a 10MP image. Just add on 8 million black pixels around your source image. Done!
    Thanks that helped me a lot. I just took a photo of my Black Cat in a Coal Cellar at night with no flash and I only had a 2MP Camera. After applying your technique the results were astonishing**!!! I'm thinking of buying another 12GB of memory for my PC and experimenting with even greater resolutions. Do you think that will work?




    ** All photos mentioned in this post were taken under laboratory conditions. No animals were harmed in anyway.
    .
    .
    .
    .
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured