Click here to Skip to main content
15,795,398 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi everyone, I've tried to write code about draw line on picture, but I don't know how can I do.
1. Open picture
2. click many points on picture. For example, point 1 point2 point3 , the point will appear.
3. when you keyC from keyboard. Line will appear like point 1 ---> point 2 ---> point 3 ---> point 1 sth like that

Ps. I use Cimg.h and I don't know how to do, I've tried to read many code but don't understand at all. So I know you can help me, thank you :)

#include <cimg.h>
using namespace cimg_library;
int main(){

    CImg<unsigned char> img("picture_trial/lion.jpg");
    CImgDisplay img2(img,"Display Image");
    const unsigned char color[3] = {0,0,255};
        if(img2.key() == cimg::keyESC)

Updated 10-Apr-15 21:44pm

1 solution

As I understand your code you must see the line drawing. If you want to save the line in the picture you must call the save_jpg function on the CImg.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900