C++ :: Output String Depending On Color Detected In A Frame Video Feed

Jul 18, 2014

what I'm trying to do is output a certain string depending on the color I see in the video feed. For right now, what I've done is threshold the feed so that everything above a certain brightness shows up as Red. Now I want to have something that says if there's any red in the feed, then I output a "1" to a text box on my user interface that's showing the feed. If there is no red, then I output a "0" to the text box.

I'm using Emgu CV C ++ with VS2010.

This is the code I have so far that isn't working correctly, it's giving me a compiler error.

cvConvertScaleAbs(frameFromCamera->Ptr.ToPointer(),frameDisplay->Ptr.ToPointer(),double(1)/16,0);
cvCvtColor(frameDisplay->Ptr.ToPointer(),frameColorDisplay->Ptr.ToPointer(),CV_GRAY2BGR);
cvThreshold(frameDisplay->Ptr.ToPointer(),maskSaturated->Ptr.ToPointer(),200,255,CV_THRESH_BINARY);

[Code] .....

and the error it's giving me

BAOTFISInterface.cpp(1010): error C2664: 'Emgu::CV::Image<TColor,TDepth> ^Emgu::CV::Image<TColor,TDepth>::InRange(Emgu::CV::Image<TColor,TDepth>
^,Emgu::CV::Image<TColor,TDepth> ^)' : cannot convert parameter 1 from 'Emgu::CV::Structure::Bgr *' to 'Emgu::CV::Image<TColor,TDepth> ^'

[Code] .....

Build FAILED.

View 1 Replies


ADVERTISEMENT

C/C++ :: Read Video Frame By Frame Through Program

May 1, 2012

I m trying to read a video frame by frame through a c program for which i need to know the format of .wmv (native video file for windows) file,can i get it??

View 6 Replies View Related

Visual C++ :: Placing Image In Kinect Color Frame?

Dec 10, 2012

I m trying to place an image on the colour frame of the Kinect live video. I m able to overlay the image using alpha blending mechanism.

The image used is a bitmap image of dimension 128*128.

The Kinect has a resolution of 640*480.

IDE used is Visual studio 2010 and I m developing using c++.

The Kinect has a render target whose size is taken as 640*480 so that it stretches for the complete window. So when I try to overlay the image it appears 5 times because of this stretching.
If I increase the image size to 640*128 i get a single image that is stretched horizontally across the window with dimension 640*480.

I have created a function that will create a render target with bitmap properties and size equal to 640*480. This is used to store the data from the Kinect, frame by frame, and draw it on to the screen

So I think when I overlay the image, it gets replicated 5 times to meet the render target size.By default the image is placed at the left top position.

My doubts are

- How can I use different functions to specify the size of render target for Kinect as 640*480 and the size of render target for bitmap image as 128*128.

- How to I give overlay or place the image on the live video at a specific location.

View 2 Replies View Related

C++ :: Video Game - Compare 3 Players Score And Output Highest

Oct 21, 2013

I was tasked with creating a program that asks for the scores of three gamers then takes these scores and outputs the highest. I THINK I have the other parts down but I don't know how to get the program to compare the scores and output the highest without having to write a long list of commands comparing playerone to playertwo, then player one to playerthree, then player two to playerone, etc.

#include <iostream>
using namespace std;
int main () {
int playerOne, playerTwo, playerThree;
cout << "Please enter score for Player One: ";
cin >> playerOne;

[Code] .....

View 10 Replies View Related

C/C++ :: Color Conversion - Skewed Output

Mar 29, 2014

What the issue is with my algorithm, though it seems to match others that are out there. I believe the output is wrong for what it should be.

Input:

50 50 50
0 0 0
255 255 255
0 100 100
200 200 0
150 0 150
300 0 0
1 1 1
0 0 245

Code:

#include <iostream>
#include <fstream>
using namespace std;
void isValid(int, int, int);
float maximum(float, float, float);
void RGBtoCMYK(float, float, float, float &, float &, float &, float &);

[Code] .....

Output:

0 0 0 0.803922
0 0 0 1
0 0 0 0
1 0 0 0.607843
0 0 1 0.215686
0 1 0 0.411765
0 1 1 -0.176471
0 0 0 0.996078
1 1 0 0.0392157

View 8 Replies View Related

C/C++ :: How To Give A Color To The Text That Displayed In Output Screen

Jan 27, 2013

i am using c++v30.5 version i want red color text in in my output screen . i viewed various site but the result is 0 ,wat to do?

View 2 Replies View Related

C# :: How To Create RSS News Feed In WPF

Feb 15, 2015

I want creation such as this program by using WPF in visual C# such as this program :

on mouse hover show the under line and show tool tip in the message if click this you can reading all subject and how can created the form if you checked all check box you can reading all news in all websites

View 6 Replies View Related

C# :: How To Get Color Of Brushes To String

Apr 4, 2015

How can I get the color of Brushes to string?

When I write:

private Brush currentColor = Brushes.White;
label4.Text = currentColor.ToString();

The label shows:

System.Drawing.SolidBrush

View 3 Replies View Related

C++ :: Read Text File To Stringstream But Keep Line Feed

Jun 6, 2013

I build this function in my C++ code. I run the on a UNIX box, build HTML file to use in Windows.

In HTML file building code, I have only a string variable hold the contents of this text file (from unix) & add it into HTML file.

The issue is that when I view the HTML file on windows, it shows all the lines in the text file as one line. I think it lost the CRLF.

My question is when I add lines from text file (reading one line at a time) in UNIX, how do I maintain CRLF ( ) in the stringstream variable so that it will display on HTML in Windows properly, all the lines as it is in unix.

I am aware UNIX uses for line end.

string TextFileToString(string filename) {
string line;
stringstream dosString;
ifstream inFile;

[Code] ......

View 4 Replies View Related

C :: LED Switch On When Error Detected?

Jul 9, 2013

I'm currently doing a project which will trigger an alarm and light up an LED when a character 'E' is detected from a bluetooth input. I'm supposed to program a pic18f4525 board.

I'm having troubles with where to start on the codes to enable the LED to light up upon detection of character 'E'. I'm using ports RD0-RD3. This is how I initialised them in the main loop.

Code:
TRISD = 0b11000000;
PORTD = 0xC0;

Am I doing the initialising right? Also, how to program it to light up when the character's detected?

View 2 Replies View Related

C# :: WPF Using Color Resource In Rectangle Stroke Color

Sep 7, 2014

Trying to define some global colors so I can use the one instance though-out my application. Here is my color code:

<Color x:Key="GlobalTextColor">#E0E0E0</Color>

But this color doesn't display in the list when I start to type {StaticResource ...}

This is the code where I'm trying to reference the color, see Stroke="{StaticResource GlobalTextColor}". GlobalTextColor doesn't actually come up in the list so won't work.

<Style x:Key="InputButton" TargetType="Button">
<Setter Property="Background" Value="#FF141414" />
<Setter Property="HorizontalAlignment" Value="Left" />

[Code].....

View 2 Replies View Related

Visual C++ :: MFC CRecordset Heap Corruption Detected At Close

Oct 28, 2013

I recently upgraded my operating system from Windows XP to Windows 7 SP1 64 bit. We are using Visual Studio 2008 Professional Edition and Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production.

When I try to execute this code I am getting the below exceptions

HTML Code:
try {
CDatabase *pDatabase = CDatabaseConnection::getDatabaseConnectionProcessLog();
ORSProcessLog rsProcessLog(pDatabase);

[Code] .....

Where rsProcessLog is the CRecordset object using a successfully connected database pointer pDatabase

In 32- bit Debug version I get a message box at rsProcessLog.Close(); with the below text Debug Error

Program: ......Test.exe

HEAP CORRUPTION DETECTED: after Normal block (#506) at 0x0087F628. CRT detected that the application wrote to memory after end of heap buffer.

Memory allocated at f:ddvctoolsvc7libsshipatlmfcsrcmfcdbcore.cpp(2626)

(Please Retry to debug the application)

In 32- bit Release version I get a message box at rsProcessLog.Close(); with the below text Windows has triggered a breakpoint in Test.exe

This may be due to a corruption of the heap, which indicates a bug in Test.exe or any of the DLLS it has loaded.

This may also be due to the user pressing F12 while Test.exe has focus.

The output window may have more diagnostic information.

The above code was a working code in Windows XP with the rest of the env remaining the same and it continues to run in Windows XP but not in Windows 7.

View 9 Replies View Related

C Sharp :: Unreachable Code Detected When Adding Switch Statement

Oct 28, 2013

I am getting an error "Unreachable code detected" when I add a switch statement.

My code looks like:

private void calbtn_click(object sender, EventArgs e) {
  double regFee;
  double lodging;
  double days;
  string Total  {
    string course;

[Code] ....

(Everything works functionally until I try to add the switch statement.)

View 2 Replies View Related

C++ :: Frame Per Second Algorithm?

Aug 27, 2013

i was trying to achieve a better way of game looping. so i have a game loop algrithm. but i dont think its quite good. i want it to be better.

here is my algorithm

bool quit = false;
while(quit == false) {
while(blah blah events)//here we hold events {
if(the user want to quits) {
quit = true;

[code]....

View 2 Replies View Related

C# :: How To Show A Frame Of Gif

Jan 10, 2015

I want to show a frame of a gif image. I searched and found that the following code should work, but it doesn't work. it detects the number of frames correctly but it shows the whole frames of gif instead of the specified frame.

Image[] frames = new Image[36];
Image GG = Image.FromFile(@"C:UsersAdministratorTEST C#TEST2frame2chef.gif");
FrameDimension dimension = new FrameDimension(GG.FrameDimensionsList[0]);
// Number of frames
int frameCount = GG.GetFrameCount(dimension);
label1.Text = frameCount.ToString();
// Return an Image at a certain index
GG.SelectActiveFrame(dimension, 1);
frames[1] = ((Image)GG.Clone());
pictureBox1.Image = frames[1];

View 2 Replies View Related

C++ :: MP3 Frame Header Importing

Jun 24, 2013

Code:

/* some useful headers */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

//my headers
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>

[XCode] .....

The bit that's giving me issues is the "calculatedetails" function, where an mp3 file is opened in binary and then an array of chars is filled with the binary data.

The problem I'm having is that I want to be able to read the constituent bits of the characters in, so that I can find the mp3 frame headers (12 1's in succession)

I'm aware that the section I've added in to perform this is incorrect.

View 7 Replies View Related

C/C++ :: Input Lowercase String / Output Uppercase String

Dec 3, 2014

write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use a character array to store the string.) Does this follow the criteria? This program is very similar to one I found on these forums but I have one problem, it outputs everything backwards! EX: dogs will output to SGOD. What I need to do to make it output correctly, I think it may have to do with getline?

#include <iostream>
#include <cctype>
#include <cstring>
using namespace std;
int main() {
char let[100];
cout << "Enter what you would like to be UPPERCASE: ";

[Code] ....

View 2 Replies View Related

C++ :: How To Move Sprite Depending On Rotation

Jan 13, 2015

how I want my sprite movement to work: if my sprite is faced upwards and i press W, it will move up. If my sprite is faced to the right and i press W, it will go right. etc. // It doesn't work like that right now and how to do it.The sprite's rotation works fine.

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) {
playerSprite.rotate(-0.08 * dt);
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) {
playerSprite.rotate(0.08 * dt);

[code]....

My question is how do I move the character depending on the rotation?

Also, you might see the "if(havePlayersCollided == false) {playerSprite.move(yadiyada)}" . yes i dont need the haveplayerscollided function because it doesnt work the way I want it to. I might make a thread for it in the future, but right now I need to get the rotation movement fixed before I move onto the collision detection between players.

View 7 Replies View Related

C++ :: Loop Depending On User Input

Jul 31, 2013

I'm trying to get this program to loop the number of times I get it to input. The program compiles alright, and it does loop when I tell it too, but how do I output the grades of the multiple students?

#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
int weighted1 = 0;
int weighted2 = 0;

[Code] .....

View 12 Replies View Related

C# :: Reorder List Depending On Dependencies?

Feb 23, 2015

I have a list of calculated fields, these fields reference other fields in their calculations. I need to create these fields beforehand as they will not exist.

I was wondering what would be the best approach for this Example List

Field1 has Field2 in the calculation
Field2 has Field4 in the calculation
Field3 has Field1 in the calculation
Field4

I'm not sure on how to approach this.

Create list in this order

Field4
Field2
Field1
Field3

View 7 Replies View Related

C++ :: Returning A Different Data Type Depending On A Variable?

May 2, 2013

Okay, I've been working on this Texture class that's going to be compatible with both SDL and OpenGL with the capability to create an array of textures within one class as opposed to multiple classes and such.

Now I've run into a slight issue if I want to return the value of a texture. There's two different types of textures: SDL_Texture, and a standard GLuint Texture. The problem I have is that one or the other is used, not both which is depending on whether or not the person is using OpenGL.

So when the user wants to get the texture, I need the ability to return either an SDL_Texture, or GLuint depending on whether or not OpenGL is being used.

I tried this with a template class, but it didn't work, but I'll post the code so you can see what I'm trying to do.

template <class Tex> Tex Texture::GetTexture(int TextureNumber)
{
if (TextureNumber > NumTextures || TextureNumber < 0)
return;

[Code]....

It basically just comes down to the last four lines of code. If the person is Using OpenGL return a GLuint, if the person is using SDL, return an SDL_Texture.

I would prefer to have the GetTexture function to be one function instead of two separate ones so I don't have to call a different function every time to check if I'm using SDL or OpenGL.

View 4 Replies View Related

C/C++ :: Drawing Array But Breaks Depending On Size

Jul 3, 2014

I am working on a code and first i need to initialize the array depending on the size (min size 3x3, maximum size 9x9). The initialized array will descend in order. Note that it seems like a simple code and seems to work for any size from 3x3 to 7x7, but for some reason i get a strange output in the last few rows for 8x8 and 9x9. Not sure why. The second part to my problem is the very last digit of 0. I did hard code to define it but i would like to make it a character like an underscore...what is the easy way to do this?

* Implements the Game of Fifteen (generalized to d x d).
*
* Usage: ./fifteen d
*
* whereby the board's dimensions are to be d x d,
* where d must be in [MIN,MAX]
*
* Note that usleep is obsolete, but it offers more granularity tha sleep and is simpler to use than nanosleep; `man usleep` for more.

#define _XOPEN_SOURCE 500

#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// board's minimal dimension
#define MIN 3

[Code] .....

View 14 Replies View Related

C# :: Creating Controls Which Act Differently Depending On Mode

Apr 24, 2014

I am creating a C# windows application which allows it to connect to our devices and communicate with them.

Often we need to customise this application and I have made this easier by defining its appearance and actions within an XML file which gets read in every time the application starts up. This is working really well.

However editing this XML file can be pretty laborious and often requires many cycles to get everything correct again. So I have started to create a graphical editor which allows for the XML to be generated.

The problem I am facing is that I am using the same controls in the final program and the editor so my question is how should I structure the code so that each control knows when it is in "Normal" mode and when it is in "Edit" mode?

I have started using a simple boolean flag to indicate its mode, however this now means that within every function I need to check this flag and run code appropriate to that mode, this seems a bit over the top. Is there a better/standard way this sort of this is done?

View 1 Replies View Related

C# :: Switch To End Or Start Of Array Depending On Conditions?

Apr 1, 2015

I have a seat allocation algorithm for an airplane 30 x 6 seats. The plane is 'split' front (1 - 15) and back (16 -30), right (A,B,C) and left (D,E,F). I am placing passengers in window seats front right centre (15A) first then back left centre (16F) followed by (15F) followed by (16A). This will continue for single passengers middle seats then aisle.

Another part of the algorithm is to ensure parties >2 or <=6 to sit together in an empty row, if not possible the party will be split as to not have a person in the party sitting alone firstly. i.e. 6 is 3 + 3 or 2 + 2 + 2 or 4 + 2 or 3 + 2 + 1 or 4 + 1 + 1 or 3 + 1 + 1 + 1 and so.

I have got it working for one person but seating two people is a bit more difficult. I am trying to get 15A,15B then 16E,16F then 16A,16B then 15E,15F then 16C 16D and 15C 15D.

This code only allocates passengers 15 A 15B then 15C 15D then 15E 15F

//seat allocation for two people
public bool[,] seatTwoPerson(bool[,] seatArray, int startCol, int endCol, int directionX, int startRow, int endRow, int directionY)
{ //loop through seatArray section determined by parameters
//for (int col = startCol; directionX < 0 ? col >= endCol : col < endCol; col += directionX)

[code].....

View 3 Replies View Related

C# :: Using Different Instance Of Class Depending On User Input?

Jan 13, 2015

Here's the problem I want to intialise different classes based on user input. I've tried using an IF statement but the scope of an if statement would mean the rest main program wouldn't be able to see it.

View 12 Replies View Related

C++ :: Creating Function That Outputs Either 1 Or 0 Depending On Input After Checking

Feb 18, 2014

I am trying to simplify my code by creating a function which takes an input then checks whether it is "y" or "n" then outputs either 1 or 0 depending on the input. So far this is what I have

int Choice(string choice) {
while(choice.compare("n") != 0 && choice.compare("N") != 0 && choice.compare("y") != 0 && choice.compare("Y") != 0){
cout << "Please enter a valid input either [y/n] : " << endl;
cin.clear(); cin.ignore(); cin >> choice;

[Code] ...

And I call it in the program using

cout << "Do you wish to change the hubble type of any galaxies? [y/n]" << endl;
cin >> choice;
while(Choice(choice) == 1){
....
cout << "Do you wish to change the hubble type of another galaxy? [y/n]" << endl;
cin << choice;
}

It compiles fine but displays some bizarre behaviour, I need to end the line twice in order for the program to continue and sometimes it just stops working (doesn't exit just appears to be stuck in a loop).

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved