How to change this C++ code so it takes an image instead of a video?

Hi there
How to change this C++ code so it takes an image instead of a video?
Thanks.

int main()
{
VideoCapture capture;
//open capture object at location zero (default location for webcam)

capture.open(0);

//set height and width of capture frame
capture.set(CV_CAP_PROP_FRAME_WIDTH,320);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,480);

Mat cameraFeed;

SkinDetector mySkinDetector;

Mat skinMat;

//start an infinite loop where webcam feed is copied to cameraFeed matrix
//all of our operations will be performed within this loop
while(1){

//store image to matrix
capture.read(cameraFeed);

//show the current image
imshow("Original Image",cameraFeed);

skinMat= mySkinDetector.getSkin(cameraFeed);

imshow("Skin Image",skinMat);

waitKey(30);
}
return 0;
}

please do not ask ppl to write your program here.

see:

this line is taking an image, wherever that came from, the rest of the program is “boilerplate code”

i.e. if you wanted to load an image from disk, have a look at imread and the various examples there

cross-post with multiple answers: