+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Junior Member level 2
    Points: 399, Level: 4

    Join Date
    May 2017
    Posts
    22
    Helped
    0 / 0
    Points
    399
    Level
    4

    Image processing using microcontroller(PIC)

    Hello pals, I am new to PIC and I want to use it for my project. Based on its features, it is not suitable for that purpose but however since it is a prototype project I want to use it. My questions are:
    1) Can I run openCV on the microcontroller(PIC) or I have to write codes for process the image myself?
    2) How can I interface a camera with the microcontroller (PIC)?
    Am working on iris identification system. Thank you.

  2. #2
    Super Moderator
    Points: 28,225, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,414
    Helped
    1065 / 1065
    Points
    28,225
    Level
    40
    Blog Entries
    6

    Re: Image processing using microcontroller(PIC)

    As far as I know, none of the PIC familly has enough RAM memory to store neither a frame buffer, as well the temporary data for their math operations. Moreover, an 8 bit processor ( without ALU multiplier ) would require much more time to do the same job that a 32 bit core would do.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisment

        
       

  3. #3
    Full Member level 1
    Points: 1,432, Level: 8

    Join Date
    May 2014
    Posts
    115
    Helped
    33 / 33
    Points
    1,432
    Level
    8

    Re: Image processing using microcontroller(PIC)

    So are probably not able to do this using openCV on a PIC. It looks like openCV is more meant for userspace applications on Windows, Linux, etc. Extensive porting may be required and is probably not what you are looking for to start with a PIC. Also it would matter if it was a PIC10, 12, 16, 18, 24, 32. The word size varies between them: 8, 16, 32 bits. The PIC32 is actually MIPS versus Microchips hardvard PIC architecture. The cores also vary in terms of implementation for example hardware multiply. This would all come into play in determining performance and what would be required to port it. Also the program memory alone would probably be a deal breaker here.

    openCV may be possible on something like a Raspberry PI or Beagle Bone.

    You probably could do image processing on a PIC, but this would be for more of an exercise of theory than practicality. The question is how fast, how complex of image processes, and how large of an image. I would recommend starting out with custom code, as you will probably be doing that in the porting process alone. (You could take concepts from it though.) So it could do simple things like flipping the colors and stuff. However for much more I would recommend a larger processor. A PIC32 and maybe a PIC24E/H would be a good place to start.

    Just to be annoying: So RAM could be worked around using external memory, but that would be really slow. Again the lack of an ALU does not make it impossible, just slow. Now not having an ALU will increase the program size which most microcontrollers do not allow external program memory. (Now you could make program the reads an external memory chip that executes the instructions from that. Which would be really really slow and inefficient.) For example someone claims to have built a ARM emulator on a PIC. Then proceeded to use this to boot an ARM distro of the linux kernel. It took forever, but supposedly worked.

    What kind of camera it was would determine how to connect it. Again there are lots of little tricks to make it work, but you would probably not want to do any of them in practice.



  4. #4
    Junior Member level 2
    Points: 399, Level: 4

    Join Date
    May 2017
    Posts
    22
    Helped
    0 / 0
    Points
    399
    Level
    4

    Re: Image processing using microcontroller(PIC)

    Thank you. I will use computer system to process the image if the school agrees.


    Please, have you any resources (documentation) on how to do image processing on microcontroller? I'd be glad if you can share it with me.
    if have please email it to me manpasumathias[at]gmail.co!

    PIC16 family doesn't have inbuilt USB module, ho can I interface USB to it with the computer system since it go
    lows RS232 protocol?

    [MODERATED]Consecutive posts merged

    Alright. Thanks



    •   AltAdvertisment

        
       

  5. #5
    Full Member level 1
    Points: 1,432, Level: 8

    Join Date
    May 2014
    Posts
    115
    Helped
    33 / 33
    Points
    1,432
    Level
    8

    Re: Image processing using microcontroller(PIC)

    Just to clarity a detail of my post made earlier. I meant to say the lack of an ALU multiply or other useful instructions would make it slow, but still not impossible. There is a only a couple instructions that you really need, from those you can actually implement all the others via procedures using those basic instructions. ALU is just a combination logic circuit so, not sure what the processor would be without it...

    There is several ways to get a PIC16 to talk to a computer. USB via serial or UART is one of the most common, using a bridge chip like the FTDI FT232. You can get these fairly cheap online as breakout boards.

    As for the image processing, I am sorry to say I am not going to be much help there.



  6. #6
    Advanced Member level 3
    Points: 7,143, Level: 20

    Join Date
    Jan 2015
    Posts
    997
    Helped
    318 / 318
    Points
    7,143
    Level
    20

    Re: Image processing using microcontroller(PIC)

    I think your question about using microcontrollers for image processing has already been answered. Microcontrollers are not general purpose computers and are generally used for lower-speed processing but doing that processing for days or years on end.
    I'm a bit confused about what you are trying to do with the PIC16 device - they generally have a UART (without knowing which specific device you are talking about it is had to say more) which uses 0-5V (or 0-3.3v) signal levels. You will need to use some form of interfacing chip whether you use RS232 or USB.
    Susan



    •   AltAdvertisment

        
       

  7. #7
    Junior Member level 2
    Points: 399, Level: 4

    Join Date
    May 2017
    Posts
    22
    Helped
    0 / 0
    Points
    399
    Level
    4

    Re: Image processing using microcontroller(PIC)

    Thanks a lot. I get your point.
    I thought of the same thing too, Microcontrollers don't allow pipelining because they weren't designed to and also interrupts might affect program execution when it occurs and would render the microcontroller very slow as you said. Thanks



  8. #8
    Junior Member level 2
    Points: 399, Level: 4

    Join Date
    May 2017
    Posts
    22
    Helped
    0 / 0
    Points
    399
    Level
    4

    Re: Image processing using microcontroller(PIC)

    My laptop doesn't have RS232 so am using USB port for communication



  9. #9
    Advanced Member level 3
    Points: 7,143, Level: 20

    Join Date
    Jan 2015
    Posts
    997
    Helped
    318 / 318
    Points
    7,143
    Level
    20

    Re: Image processing using microcontroller(PIC)

    In that case you will need a USB to serial converter such as the FTDI232R which has a USB (device) interface on one side and CMOS/TTL serial UART lines on the other. Simply connect the FTDI232R serial lines to the MCU's serial lines and go from there.
    Depending on exactly which USB to Serial device you use, you may need to be careful about the voltages on the serial lines - you need to either make sure they are both 5V or 3.3V, or that you have level shifters in between. (There are some 'cheap and nasty' options around level shifting so you need to understand what you are doing if you try to use those.)
    Also I didn't say that microcontrollers were 'very slow'; I said that were used for lower-speed processing. I'm using MCUs that have 70MIPS and can easily handle the audio compression/decompression and other DSP related tasks (as well as the user interface and links to a host computer). Also interrupts should not slow things down significantly if they are correctly implemented. It really comes down to selecting the appropriate device for the task.
    Susan



  10. #10
    Junior Member level 2
    Points: 399, Level: 4

    Join Date
    May 2017
    Posts
    22
    Helped
    0 / 0
    Points
    399
    Level
    4

    Re: Image processing using microcontroller(PIC)

    Thanks. actually my first reply was for [bluelassers], thanks, your reply helped a lot.

    I wasn't saying microcontrollers are slow, I was saying that image processing would render it slow and may affect other parts of the programs like interrupts as I was told but never tried. Thanks a lot for your response, I will do as you guys have suggested.


    A very big thank you to you all



--[[ ]]--