ios: change the colors of a UIImage

The easiest and shortest: Way to do that in case when you dealing with UIImageView: Obj-C: theImageView.image = [theImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [theImageView setTintColor:[UIColor redColor]]; Swift: let theImageView = UIImageView(image: UIImage(named:”foo”)!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)) theImageView.tintColor = UIColor.redColor()

openCV program compile error “libopencv_core.so.2.4: cannot open shared object file: No such file or directory” in ubuntu 12.04

You haven’t put the shared library in a location where the loader can find it. look inside the /usr/local/opencv and /usr/local/opencv2 folders and see if either of them contains any shared libraries (files beginning in lib and usually ending in .so). when you find them, create a file called /etc/ld.so.conf.d/opencv.conf and write to it the … Read more

Detect and visualize differences between two images with OpenCV Python

Method #1: Structural Similarity Index (SSIM) To visualize differences between two images, we can take a quantitative approach to determine the exact discrepancies between images using the Structural Similarity Index (SSIM) which was introduced in Image Quality Assessment: From Error Visibility to Structural Similarity. This method is already implemented in the scikit-image library for image … Read more

Automatic perspective correction OpenCV

For perspective transform you need, source points->Coordinates of quadrangle vertices in the source image. destination points-> Coordinates of the corresponding quadrangle vertices in the destination image. Here we will calculate these point by contour process. Calculate Coordinates of quadrangle vertices in the source image You will get the your card as contour by just by … Read more

Camera position in world coordinate from cv::solvePnP

If with “world coordinates” you mean “object coordinates”, you have to get the inverse transformation of the result given by the pnp algorithm. There is a trick to invert transformation matrices that allows you to save the inversion operation, which is usually expensive, and that explains the code in Python. Given a transformation [R|t], we … Read more

‘unresolved external symbol’ error when linking with OpenCV 3.0

Here the steps to use OpenCV 3.0.0 with precompiled libs, for a C++ project that links OpenCV statically, in Windows (tested with Windows 8.1) and Visual Studio (tested with Visual Studio 2013) to run this program: #include <opencv2\opencv.hpp> using namespace cv; int main() { Mat3b img = imread(“path_to_image”); imshow(“img”, img); waitKey(); return 0; } Download … Read more

2 usb cameras not working with opencv

The typical reason for 2+ USB cameras to not work together (still they might be working fine separately) is that USB bandwidth is insufficient for them both to run simultaneously. There is a bandwidth limit, which is rather low: The maximum throughput of an isochronous pipe (which is usually used for video) is 24MB/s. More … Read more

Nonfree module is missing in OpenCV 3.0

with opencv3.0, SURF/SIFT and some other things have been moved to a seperate opencv_contrib repo . you will have to download that, add it to your main opencv cmake settings (please look at the readme there), and rerun cmake/make. then: #include “opencv2/xfeatures2d.hpp” … Ptr<SIFT> sift = cv::xfeatures2d::SIFT::create(…); sift->detect(…);