|
|
Thanks! I already read this one though. But unfortunately it did not solve my problem. It's just weird that there are certain sizes of the bitmap that it can't display.
|
|
|
|
|
Does CImage::Save solve your problem of course it saves uncompressed bitmap but you have other choices like jpg,...
|
|
|
|
|
I just use WriteFile() and write the BITMAPFILEHEADER and BITMAPINFOHEADER and then the char * containing the data. I am thinking maybe I got something wrong off my bitmap header, but it works on other values like 3200x3200 and 1600x1600. But when it comes to 1067x1067 it does not. I checked the char * to see whether I got the size of data wrong but it is right. Checking the bitmap file that I produced(1067x1067) it seems right. I just dont get it why it doesnt display. I pasted below the header of the bitmap file for reference. Thank you for the help and time!
42 4D E1 1D 34 00 00 00 00 00 36 00 00 00 28 00 00 00 2B 04 00 00 2B 04 00 00 01 00 18 00 00 00 00 00 AB 1D 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
|
|
|
It seems your problem solved.;)
|
|
|
|
|
Yes it has been! Thanks a lot for all your help and time to solve this problem!
|
|
|
|
|
Try to keep height and width of your bmp in multiple of 4.
Hope this will help you.
Regards,
Paresh.
|
|
|
|
|
Yes it does help! though the application's requirements are to display it in different multiples. Really tough. I'm just wondering why the bitmap won't work on other multiples besides 2 and 4. Thanks a lot for the help though!
|
|
|
|
|
|
Wow nice articles! I might find the answer in one of them. Thanks Paresh for the help!
Edit: Your right! It must be on a multiple of 4! Nice research on the articles! Thanks a lot for the help!
|
|
|
|
|
Llasus wrote: I'm just wondering why the bitmap won't work on other multiples besides 2 and 4
For bitmap's the pixels that represent one row should be a multiple of four.
Suppose you have a bitmap of bit dept 24 and width 150. In that case the total byte required to represent on row is
( 24/8 )*150 = 450. But this is not divisible by four. In this case you have to add dummy bytes in the end of each row. In the above example the number of dummy bytes will be
int nBytesNeed = 4 - (450%4);// = 2
so append a 2 bytes at the end of each row. Thus for each row the number of bytes will be 452.
|
|
|
|
|
Yupyup! I realized that just earlier. Im gonna do some revisions for my code now for that extra padding needed. Thank you for your help!
|
|
|
|
|
I wanted to write some code or use a library to take the screen as an array of pixels and to locate a specific pixel by x-y axis of the screen, so for example I am running a program on the side which displays its output as graphics, like a card game, now I want to read the cards, in order to do this I will have to read the pixel at a specific location and see if it matches with a different array to "figure" out which card was displayed, and then have the program take the appropriate action. For example if it is poker and the cards are good to press a button to call/raise instead of folding and vice versa. Basically I need to read the screen, or a window and interpret the visual state.
|
|
|
|
|
Im not sure do you need to GetPixel ?
|
|
|
|
|
Just a suggestion. You can start by studying all about CDC.
CWnd* MyDlg;<br />
CDC* MyDC;<br />
<br />
MyDlg = GetDlgItem(IDC_DISPLAYPANEL);
MyDC = MyDlg->GetDC();
From here by getting the CDC of your dialog, you can obtain it's bitmap by using CreateCompatibleBitmap() and obtain the data you'll need from your Bitmap object. Haven't tried it yet, though I am sure that these are the ones you will be needing for your application. Hope that helps.
|
|
|
|
|
I'm not sure about the above two methods.. And I'm sure they work fine but I think that getting pixel values is quite intensive on the CPU/GPU, especially if you are getting a lot of pixel values at the same time..
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Yup, I was thinking about the heavy processing that it will require, specially the comparison. But if it is what was required of his application then it will be tough. Maybe he can just do the computation and comparison by using variables inside the program, instead of capturing the image outside.
|
|
|
|
|
Llasus wrote: Yup, I was thinking about the heavy processing that it will require
Yes it would .. another thing to do would be to inject a DLL into the application and then monitor the messages to and from the window.. With this he could then send messages to the window to do certain tasks (if this is supported), and if, for example, there are custom messages, to get the numbers on certain cards.
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Dear all
i have a issue here, please help me. thanks.Build : warning : failed to (or don't know how to) build 'C:\Documents and Settings\Administrator\Desktop\Particle paper\VC++\facerecognition\ÀûÓÃVFW½øÐÐÊÓƵ²¶×½\VFWImageProcessor.cpp'
Compiling...
VFWImageProcessor.cpp
fatal error C1083: Cannot open source file: 'C:\Documents and Settings\Administrator\Desktop\Particle paper\VC++\facerecognition\ÀûÓÃVFW½øÐÐÊÓƵ²¶×½\VFWImageProcessor.cpp': No such file or directory
Error executing cl.exe.
FaceDetect.exe - 1 error(s), 1 warning(s)
unenglish character in directory above is another language of other country, but i couldn't find in directory. so how i can find it and replace english language. thanks a lot.
Li Zhiyuan
9/07/2007
|
|
|
|
|
Are you sure you have this file?
|
|
|
|
|
Your OS seems to not support the language for the folder containing your files, that's the reason why it can't see the folder in the first place. It is better to just change the folder name to english so that your compiler can see that directory, if it exists. But it might be possible that because your OS doesn't support that language, it can't show it in your PC. Why not just develop and run the code on an OS with the same language as the code your trying to develop, or add the language pack your OS needs to read that directory.
|
|
|
|
|
PLEASE read the forum guidelines. You have been told before not to use message titles like 'need help.' Everyone here needs help. Give your messages titles that are meaningful.
______________________
stuff + cats = awesome
|
|
|
|
|
how do I write to command prompt from a MFC dialog app? How can I get the "cout" object?
Thanks
|
|
|
|
|
|
Hi,
Description of first LoadKeyboardLayout() parameter:
pwszKLID
[in] Pointer to the buffer that specifies the name of the input locale identifier to load. This name is a string composed of the hexadecimal value of the Language Identifier (low word) and a device identifier (high word). For example, U.S. English has a language identifier of 0x0409, so the primary U.S. English layout is named "00000409". Variants of U.S. English layout (such as the Dvorak layout) are named "00010409", "00020409", and so on.
I can find language identifiers list in registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts), but where do I find "device identifiers" ??? Because now I'm able to set whatever language with default keyboard, but not specified keyboard( which is exactly what I want ).
thanks
Vilius
|
|
|
|