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.
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??
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.
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;
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
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'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?
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.
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.
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];
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.
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: ";
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.
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.
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;
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
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.
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.
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.
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?
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)
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.
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).