Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. OPENCV in grey-scale, another1 know how to convert to a colour output ..

OPENCV in grey-scale, another1 know how to convert to a colour output ..

Scheduled Pinned Locked Moved Visual Basic
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    changjiang7
    wrote on last edited by
    #1

    #include "stdlib.h" #include "stdio.h" #include "cv.h" #include "highgui.h" char *filename; IplImage *image =0,*image2 =0, *image3=0; uchar* colourpixels; int main(int argc, char** argv) { cvNamedWindow("Source Image",2); cvNamedWindow("test",2); if(argc ==2) { filename=argv[1]; } else exit(0); if((image=cvLoadImage(filename,0))==0) return -1; image2= cvCloneImage(image); image3=cvCreateImage(cvSize(image->width, image->height), IPL_DEPTH_8U, 1); // create pixel by pixel for(int pos_y=0;pos_y<image2->height;pos_y++) { for(int pos_x=0;pos_x<image2->width;pos_x++) { colourpixels = &((uchar*)(image2->imageData+image2->widthStep*pos_y))[pos_x*1]; (image3->imageData+image3->widthStep*pos_y)[image3->width-1+(pos_x*1)]=*colourpixels; } } cvShowImage("Source Image",image); cvShowImage("test",image3); cvWaitKey(0); cvReleaseImage(&image2); cvReleaseImage(&image); return 0; }

    D 1 Reply Last reply
    0
    • C changjiang7

      #include "stdlib.h" #include "stdio.h" #include "cv.h" #include "highgui.h" char *filename; IplImage *image =0,*image2 =0, *image3=0; uchar* colourpixels; int main(int argc, char** argv) { cvNamedWindow("Source Image",2); cvNamedWindow("test",2); if(argc ==2) { filename=argv[1]; } else exit(0); if((image=cvLoadImage(filename,0))==0) return -1; image2= cvCloneImage(image); image3=cvCreateImage(cvSize(image->width, image->height), IPL_DEPTH_8U, 1); // create pixel by pixel for(int pos_y=0;pos_y<image2->height;pos_y++) { for(int pos_x=0;pos_x<image2->width;pos_x++) { colourpixels = &((uchar*)(image2->imageData+image2->widthStep*pos_y))[pos_x*1]; (image3->imageData+image3->widthStep*pos_y)[image3->width-1+(pos_x*1)]=*colourpixels; } } cvShowImage("Source Image",image); cvShowImage("test",image3); cvWaitKey(0); cvReleaseImage(&image2); cvReleaseImage(&image); return 0; }

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      ...and this has what to do with VB.NET??

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        ...and this has what to do with VB.NET??

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        S Offline
        S Offline
        Smithers Jones
        wrote on last edited by
        #3

        ...and there is no question either.

        "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups