How to create a vector of images in opencv ?
i need store various images in a vector using opencv ? How to make this ?
i need store various images in a vector using opencv ? How to make this ?
I think this should be straight straithforward supposing you know how to read images.
Mat image1 = imread("location_image1");
Mat image2 = imread("location_image2");
vector<Mat> various_images;
various_images.push_back(image1);
various_images.push_back(image2);
With this code you can create loops of your desire!
UPDATE:
And to access elements of your matrix, it all kind of depends what type of matrix you are using but in the case of a matrix of type CV_8UC1
you can use the command
int currentElement = image.at<uchar>(row,col);
If you have a multi channel image than first use the split
function
UPDATE 2:
Access of a vector is done by
Mat retrieve_element = various_images[index];
where index is a number between 0 and amountElements-1
Steven how to access the elements of a vector ? Do you know ?
Added above! But this can all be found in the documentation of OpenCV ...
Sorry! I answer wrong. I need access the image of a vector. How to access ?
Asked: 2015-02-28 14:42:49 -0600
Seen: 9,914 times
Last updated: Feb 28 '15
how to align vector and raster images?
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
OpenCV DescriptorMatcher matches
Can't compile .cu file when including opencv.hpp
Is stereoRectifyUncalibrated efficient?
Using OpenCV's stitching module, strange error when compositing images
compile error in opencv2/flann/lsh_table.h when compiling bgslibrary