2021-01-26 13:16:05 -0600
| received badge | ● Famous Question
(source)
|
2020-10-21 14:58:13 -0600
| marked best answer | modify pixel of image with 0.01 hi,
i have a image i want to modify it each pixel of image having 0 value with 0.01. below is the code to replace the value 0 with 0.01. but it is not doing any thing. code - for (int y=0; y<contrast.rows; y++)
{
for (int x=0; x<contrast.cols; x++)
{
if(contrast.at<uchar>(y, x) ==0)
contrast.at<uchar>(y, x) = 0.01;
}
}
thanks |
2020-09-22 08:36:13 -0600
| received badge | ● Famous Question
(source)
|
2020-07-24 00:28:34 -0600
| received badge | ● Popular Question
(source)
|
2020-01-27 13:03:03 -0600
| received badge | ● Notable Question
(source)
|
2019-09-23 22:56:20 -0600
| received badge | ● Notable Question
(source)
|
2019-09-21 11:05:43 -0600
| received badge | ● Notable Question
(source)
|
2019-09-09 12:43:26 -0600
| received badge | ● Popular Question
(source)
|
2018-12-27 13:14:22 -0600
| received badge | ● Notable Question
(source)
|
2018-03-16 04:52:43 -0600
| received badge | ● Popular Question
(source)
|
2017-11-17 06:46:20 -0600
| received badge | ● Popular Question
(source)
|
2017-09-09 23:32:17 -0600
| received badge | ● Famous Question
(source)
|
2017-08-10 03:40:59 -0600
| received badge | ● Notable Question
(source)
|
2017-05-08 04:51:01 -0600
| received badge | ● Popular Question
(source)
|
2017-03-18 07:23:13 -0600
| received badge | ● Notable Question
(source)
|
2016-09-22 07:06:16 -0600
| received badge | ● Notable Question
(source)
|
2016-07-04 10:19:29 -0600
| received badge | ● Popular Question
(source)
|
2016-03-15 16:49:42 -0600
| received badge | ● Popular Question
(source)
|
2016-01-10 01:27:03 -0600
| received badge | ● Popular Question
(source)
|
2015-10-06 09:10:45 -0600
| received badge | ● Student
(source)
|
2015-08-27 01:34:13 -0600
| commented question | Find angle and rotation of point Dear LBerger,
i want to know conceptually why this is being done to find 3 points. with a difference of 16.
i know the meaning of operator %. |
2015-08-27 01:19:09 -0600
| commented question | Find angle and rotation of point can you explain me why the following is done :
what is its meaning cv::Point p0 = (pt>0) ? contour[pt%size] : contour[size - 1 + pt];
cv::Point p1 = contour[(pt + r) % size];
cv::Point p2 = (pt>r) ? contour[pt - r] : contour[size - 1 - r];
|
2015-08-27 01:09:33 -0600
| commented question | unable to understand this finger counting code sorry for making duplicate |
2015-08-27 00:34:09 -0600
| asked a question | unable to understand this finger counting code hi,
can anybody explain me this code:
this code is for counting number of finger.
this is the input image
// feature extraction.cpp : Defines the entry point for the console application.
//
//--------------------------------------In the name of GOD
//-------------------------------BOW+SVM by Mohammad Reza Mostajabi
//#include "stdafx.h"
#include <opencv\cv.h>
#include <opencv\highgui.h>
//#include <opencv\ml.h>
#include <stdio.h>
#include <iostream>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2\ml\ml.hpp>
#include <vector>
using namespace cv;
using namespace std;
using std::cout;
using std::cerr;
using std::endl;
using std::vector;
RNG rnga(12345);
inline void mix_channels(cv::Mat const &src, cv::Mat &dst, std::initializer_list<int> from_to)
{
cv::mixChannels(&src, 1, &dst, 1, std::begin(from_to), from_to.size() / 2);
}
double angle(std::vector<cv::Point>& contour, int pt, int r)
{
int size = contour.size();
cv::Point p0 = (pt>0) ? contour[pt%size] : contour[size - 1 + pt];
cv::Point p1 = contour[(pt + r) % size];
cv::Point p2 = (pt>r) ? contour[pt - r] : contour[size - 1 - r];
double ux = p0.x - p1.x;
double uy = p0.y - p1.y;
double vx = p0.x - p2.x;
double vy = p0.y - p2.y;
return (ux*vx + uy*vy) / sqrt((ux*ux + uy*uy)*(vx*vx + vy*vy));
}
int rotation(std::vector<cv::Point>& contour, int pt, int r)
{
int size = contour.size();
cv::Point p0 = (pt>0) ? contour[pt%size] : contour[size - 1 + pt];
cv::Point p1 = contour[(pt + r) % size];
cv::Point p2 = (pt>r) ? contour[pt - r] : contour[size - 1 - r];
double ux = p0.x - p1.x;
double uy = p0.y - p1.y;
double vx = p0.x - p2.x;
double vy = p0.y - p2.y;
return (ux*vy - vx*uy);
}
bool isEqual(double a, double b)
{
return fabs(a - b) <= 1e-7;
}
int main()
{
Mat input = imread("C:\\Users\\Intern-3\\Desktop\\IPF\\2.png");
Size size = input.size();
int erosion_size = 1;
Mat HSV, threshold;
cvtColor(input, HSV, COLOR_BGR2HSV);
inRange(HSV, cv::Scalar(0, 0, 100), cv::Scalar(0, 0, 255), threshold);
Mat erodeElement = getStructuringElement(MORPH_RECT, cv::Size(5, 5));
Mat dilateElement = getStructuringElement(MORPH_RECT, cv::Size(8, 8));
erode(threshold, threshold, erodeElement);
vector<vector<Point>> contours;
vector<Vec4i> hierarchy;
Mat mask = threshold;
findContours(mask.clone(), contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, Point(0, 0));
/// Draw contours
Mat drawing = Mat::zeros(mask.size(), CV_8UC3);
for (int i = 0; i< contours.size(); i++)
{
Scalar color = Scalar(rnga.uniform(0, 255), rnga.uniform(0, 255), rnga.uniform(0, 255));
drawContours(drawing, contours, i, color, 2, 8, hierarchy, 0, Point());
}
cout << "Contours = " << contours.size() << endl;
for (int i = 0; i < contours.size(); i++)
{
cout << "area : " << contourArea(contours[i]) << endl;
}
imshow("contour", drawing);
if (!contours.empty())
{
for (int i = 0; i<contours.size(); i++)
{
if (cv::contourArea(contours[i])>500)
{
Point center;
std::vector<cv::Point> fingers;
std::vector<cv::Point> contour;
cv::Moments m = cv::moments(contours[i]);
center.x = m.m10 / m.m00;
center.y = m.m01 / m.m00;
for (int j ... (more) |
2015-08-26 08:24:32 -0600
| asked a question | Find angle and rotation of point hi ,
i want to find the angle. i find the following code can anyone explain me its meaning.
here why p0,p1,p2 are being findout.
what is the meaning of (uxvx + uyvy) / sqrt((uxux + uyuy)(vxvx + vyvy) and (uxvy - vx*uy) here. double angle(std::vector<cv::Point>& contour, int pt, int r)
{
int size = contour.size();
cv::Point p0 = (pt>0) ? contour[pt%size] : contour[size - 1 + pt];
cv::Point p1 = contour[(pt + r) % size];
cv::Point p2 = (pt>r) ? contour[pt - r] : contour[size - 1 - r];
double ux = p0.x - p1.x;
double uy = p0.y - p1.y;
double vx = p0.x - p2.x;
double vy = p0.y - p2.y;
return (ux*vx + uy*vy) / sqrt((ux*ux + uy*uy)*(vx*vx + vy*vy));
}
int rotation(std::vector<cv::Point>& contour, int pt, int r)
{
int size = contour.size();
cv::Point p0 = (pt>0) ? contour[pt%size] : contour[size - 1 + pt];
cv::Point p1 = contour[(pt + r) % size];
cv::Point p2 = (pt>r) ? contour[pt - r] : contour[size - 1 - r];
double ux = p0.x - p1.x;
double uy = p0.y - p1.y;
double vx = p0.x - p2.x;
double vy = p0.y - p2.y;
return (ux*vy - vx*uy);
}
thanks!! |
2015-05-28 00:40:29 -0600
| asked a question | How to find R,G,B percentage in an image hi,
i want to find red green and blue percentage in an image. i used the following code which shows 0%age for the red.
help to improve my code. below is code : vector<Mat> channels;
split(hsv_img,channels);
Mat red, blue, green;
inRange(channels[0], Scalar(0), Scalar(10), red); // red
// ... do the same for blue, green, etc only changing the Scalar values and the Mat
double image_size = hsv_img.cols*hsv_img.rows;
double red_percent = ((double) cv::countNonZero(red))/image_size;
what shoud i change in scalar to have green and blue value. thanks !! |
2015-02-18 06:39:39 -0600
| commented question | error in facec model = cv::createEigenFaceRecognizer(); i am getting error in this line only. if i removes this line code works well. an i removed the "initModule_contrib()" |
2015-02-18 06:30:47 -0600
| commented question | error in facec i already removed initModule_contrib(); funtion and converted the create function as you told . but still i am getting same error |
2015-02-18 05:48:17 -0600
| commented question | error in facec i have already included opencv_contrib2410 into my linker. |
2015-02-18 05:33:52 -0600
| commented question | error in facec how should i do it. i didn't get it. |
2015-02-18 05:27:51 -0600
| commented question | error in facec why i am getting the same error. i have included #include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/highgui/highgui.hpp"
these header files |
2015-02-18 05:27:04 -0600
| commented question | error in facec now this is my code : if (facerecAlgorithm == "Eigenfaces")
model = cv::createEigenFaceRecognizer();
model->train(preprocessedFaces, faceLabels);
|
2015-02-18 05:26:11 -0600
| commented question | error in facec still getting the same error |
2015-02-18 04:55:54 -0600
| asked a question | error in facec hi ,
i am getting error in facerecognizer in opencv 2.4.10.
what should i do. below is code : Ptr<FaceRecognizer> learnCollectedFaces(const vector<Mat> preprocessedFaces, const vector<int> faceLabels, const string facerecAlgorithm)
{
Ptr<FaceRecognizer> model;
cout << "Learning the collected faces using the [" << facerecAlgorithm << "] algorithm ..." << endl;
// Make sure the "contrib" module is dynamically loaded at runtime.
// Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
bool haveContribModule = initModule_contrib();
if (!haveContribModule) {
cerr << "ERROR: The 'contrib' module is needed for FaceRecognizer but has not been loaded into OpenCV!" << endl;
exit(1);
}
// Use the new FaceRecognizer class in OpenCV's "contrib" module:
// Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run!
model = Algorithm::create<FaceRecognizer>(facerecAlgorithm);
if (model.empty()) {
cerr << "ERROR: The FaceRecognizer algorithm [" << facerecAlgorithm << "] is not available in your version of OpenCV. Please update to OpenCV v2.4.1 or newer." << endl;
exit(1);
}
// Do the actual training from the collected faces. Might take several seconds or minutes depending on input!
model->train(preprocessedFaces, faceLabels);
return model;
}
error : ![image description](/upfiles/1424256649300074.png)
|
2015-02-09 23:46:57 -0600
| asked a question | OpenCV Visual Studio ntdll.dll hi,
I have trying to create a Project using OpenCV 2.4.10 on Visual Studio 2013, but I have had very little luck so far, owing to the following exceptions. Please suggest help. TIA. Error which i am getting are : Unhandled exception at 0x772A8C9E (ntdll.dll) in Color.exe: 0xC000007B: %hs is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. Error status 0x. what should i do. thanks!! |
2015-02-09 06:58:24 -0600
| asked a question | Face Detect Kinect V2 + OpenCV below is the code i am using for face detection.
the porblem is that whenever the new frame arrives the face is detected in new windows each time. i want to display the frame in single windows.
how can i do that. thanks !! code : #include "stdafx.h"
#include <Windows.h>
#include <Kinect.h>
#include <Kinect.Face.h>
#include <opencv2/opencv.hpp>
#define _USE_MATH_DEFINES
#include <math.h>
template<class Interface>
inline void SafeRelease( Interface *& pInterfaceToRelease )
{
if( pInterfaceToRelease != NULL ){
pInterfaceToRelease->Release();
pInterfaceToRelease = NULL;
}
}
// Quote from Kinect for Windows SDK v2.0 Developer Preview - Samples/Native/FaceBasics-D2D, and Partial Modification
// ExtractFaceRotationInDegrees is: Copyright (c) Microsoft Corporation. All rights reserved.
inline void ExtractFaceRotationInDegrees( const Vector4* pQuaternion, int* pPitch, int* pYaw, int* pRoll )
{
double x = pQuaternion->x;
double y = pQuaternion->y;
double z = pQuaternion->z;
double w = pQuaternion->w;
// convert face rotation quaternion to Euler angles in degrees
*pPitch = static_cast<int>( std::atan2( 2 * ( y * z + w * x ), w * w - x * x - y * y + z * z ) / M_PI * 180.0f );
*pYaw = static_cast<int>( std::asin( 2 * ( w * y - x * z ) ) / M_PI * 180.0f );
*pRoll = static_cast<int>( std::atan2( 2 * ( x * y + w * z ), w * w + x * x - y * y - z * z ) / M_PI * 180.0f );
}
int _tmain( int argc, _TCHAR* argv[] )
{
cv::setUseOptimized( true );
// Sensor
IKinectSensor* pSensor;
HRESULT hResult = S_OK;
hResult = GetDefaultKinectSensor( &pSensor );
if( FAILED( hResult ) ){
std::cerr << "Error : GetDefaultKinectSensor" << std::endl;
return -1;
}
hResult = pSensor->Open();
if( FAILED( hResult ) ){
std::cerr << "Error : IKinectSensor::Open()" << std::endl;
return -1;
}
// Source
IColorFrameSource* pColorSource;
hResult = pSensor->get_ColorFrameSource( &pColorSource );
if( FAILED( hResult ) ){
std::cerr << "Error : IKinectSensor::get_ColorFrameSource()" << std::endl;
return -1;
}
IBodyFrameSource* pBodySource;
hResult = pSensor->get_BodyFrameSource( &pBodySource );
if( FAILED( hResult ) ){
std::cerr << "Error : IKinectSensor::get_BodyFrameSource()" << std::endl;
return -1;
}
// Reader
IColorFrameReader* pColorReader;
hResult = pColorSource->OpenReader( &pColorReader );
if( FAILED( hResult ) ){
std::cerr << "Error : IColorFrameSource::OpenReader()" << std::endl;
return -1;
}
IBodyFrameReader* pBodyReader;
hResult = pBodySource->OpenReader( &pBodyReader );
if( FAILED( hResult ) ){
std::cerr << "Error : IBodyFrameSource::OpenReader()" << std::endl;
return -1;
}
// Description
IFrameDescription* pDescription;
hResult = pColorSource->get_FrameDescription( &pDescription );
if( FAILED( hResult ) ){
std::cerr << "Error : IColorFrameSource::get_FrameDescription()" << std::endl;
return -1;
}
int width = 0;
int height = 0;
pDescription->get_Width( &width ); // 1920
pDescription->get_Height( &height ); // 1080
unsigned int bufferSize = width * height * 4 * sizeof( unsigned char );
cv::Mat bufferMat( height, width, CV_8UC4 );
cv::Mat faceMat( height / 2, width / 2, CV_8UC4 );
cv::namedWindow( "Face" );
// Color Table
cv::Vec3b color[BODY_COUNT];
color[0] = cv::Vec3b( 255, 0, 0 );
color[1] = cv::Vec3b( 0, 255, 0 );
color[2] = cv::Vec3b( 0, 0, 255 );
color[3] = cv::Vec3b( 255, 255, 0 );
color[4] = cv::Vec3b( 255, 0, 255 );
color[5] = cv::Vec3b( 0, 255, 255 );
// Coordinate Mapper
ICoordinateMapper* pCoordinateMapper;
hResult = pSensor->get_CoordinateMapper( &pCoordinateMapper );
if( FAILED( hResult ) ){
std::cerr << "Error : IKinectSensor::get_CoordinateMapper()" << std::endl;
return -1;
}
IFaceFrameSource* pFaceSource[BODY_COUNT];
DWORD features = FaceFrameFeatures::FaceFrameFeatures_BoundingBoxInColorSpace
| FaceFrameFeatures::FaceFrameFeatures_PointsInColorSpace
| FaceFrameFeatures::FaceFrameFeatures_RotationOrientation
| FaceFrameFeatures::FaceFrameFeatures_Happy
| FaceFrameFeatures::FaceFrameFeatures_RightEyeClosed
| FaceFrameFeatures::FaceFrameFeatures_LeftEyeClosed
| FaceFrameFeatures::FaceFrameFeatures_MouthOpen
| FaceFrameFeatures::FaceFrameFeatures_MouthMoved
| FaceFrameFeatures::FaceFrameFeatures_LookingAway
| FaceFrameFeatures::FaceFrameFeatures_Glasses
| FaceFrameFeatures::FaceFrameFeatures_FaceEngagement;
IFaceFrameReader* pFaceReader[BODY_COUNT];
for( int count = 0; count < BODY_COUNT; count++ ){
// Source
hResult = CreateFaceFrameSource( pSensor, 0, features, &pFaceSource[count] );
if( FAILED( hResult ) ){
std::cerr << "Error : CreateFaceFrameSource" << std::endl;
return -1;
}
// Reader ... (more) |
2015-01-28 23:31:54 -0600
| asked a question | assign mat value int integer array hi,
i stucked into a little problem. I am unable to assign mat value into the integer array.
below is my code :
Mat arr = imread("image.jpg");
int histBuff[SIZE];
arr.get(0, 0, histBuff); the problem is that class mat has no member get(). what should i do |
2015-01-19 07:49:27 -0600
| commented answer | Interface Intel Realsense Camera thanks Steven , i will modify it soon |
2015-01-19 03:55:46 -0600
| answered a question | Interface Intel Realsense Camera |
2015-01-19 03:53:39 -0600
| commented question | tip of tweezer my application is to track the tip of these type of tweezer . for eye operation so that it will be helpful for the doctors. |
2015-01-18 08:23:07 -0600
| asked a question | tip of tweezer hi,
can any one guide me how to find the tip of this twiser shown here by using depth image.
|
2015-01-18 08:16:45 -0600
| commented question | convert image into binary i simply capture video frame from camera number 2
VideoCaptue cap(2);
and it is giving me 1st image. |
2015-01-18 02:19:41 -0600
| asked a question | convert image into binary hi,
i am trying to convert image into binary. while converting i got this image .
how can i make it pure white in hand part and else part in black. so that it should look exactly this image. thanks |
2015-01-12 10:02:49 -0600
| commented question | c++ interface of cvCreateImageHeader(), cvSetData() no, in depthImageData.plane[2] i am getting uv image. and in depthImageData[0] i am getting depth image. I want to ask how can i store its data in mat using cv::mat instead of iplimage pointer. |
2015-01-12 10:00:36 -0600
| commented question | How to convert pxcimage into mat sorry, i could not understand. |
2015-01-11 11:19:10 -0600
| commented question | How to convert pxcimage into mat i am not getting my answer thays why :) |