i am trying to see whether one bitmap exists inside another (which is a screen print). i am trying to use memcmp: - int main() {
-
-
HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
-
-
BITMAP bitmap;
-
GetObject(hBitMap,sizeof(BITMAP),&bitmap);
-
int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
-
-
BYTE *lpBits = new BYTE[ size ];
-
-
GetBitmapBits((HBITMAP)hBitMap,size,lpBits );
-
-
HANDLE hBitMap2 = LoadImage(0, "img2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
-
-
BITMAP bitmap2;
-
GetObject(hBitMap2,sizeof(BITMAP),&bitmap2);
-
int size2 = bitmap2.bmHeight*bitmap2.bmWidth*bitmap2.bmBitsPix el/8;
-
-
BYTE *lpBits2 = new BYTE[ size2 ];
-
-
GetBitmapBits((HBITMAP)hBitMap2,size2,lpBits2 );
-
-
int ScreenWidth = bitmap2.bmWidth;
-
int ScreenHeight = bitmap2.bmHeight;
-
int numOfCard = 1;
-
int cardHeight = bitmap.bmHeight;
-
int card_line_length = bitmap.bmWidth;
-
-
-
for( int i = 0 ; i < ScreenWidth; i++ ) {
-
for( int j = 0 ; j < ScreenHeight; j++ ) {
-
for ( int k= 0; k < numOfCard; k++ ) {
-
int tmpY = j;
-
for ( int x = 0; x < cardHeight; x++ ) {
-
if ( memcmp(lpBits2[i][tmpY],lpBits[x], card_line_length ) != 0 )
-
break; // we didnt find macth of a line
-
tmpY++; // move to next line
-
}
-
if ( x == cardHeight) {
-
cout << "found";
-
}
-
}
-
}
-
}
-
-
system("PAUSE");
-
return 0;
-
}
this is throwing the error at the moment:
invalid types `unsigned char[int]' for array subscript
which corresponds to this line:
memcmp(lpBits2[i][tmpY],lpBits[x], card_line_length )
i don't know what is going on!
3 6230
i have a problems to make a coding to compare 2 images. i am a new person in this subject. so i need help from u to give me the coding. help me
i have a problems to make a coding to compare 2 images. i am a new person in this subject. so i need help from u to give me the coding. help me
Please don't hijack this thread. If you want to ask a similar question, better
read the responses posted in this thread or if you really must, start your own
thread but don't just plunge in here.
kind regards,
Jos
BYTE *lpBits2 = new BYTE[ size2 ];
...
this is throwing the error at the moment:
invalid types `unsigned char[int]' for array subscript
which corresponds to this line:
memcmp(lpBits2[i][tmpY],lpBits[x], card_line_length )
i don't know what is going on!
the memcmp() function expects two addresses and a length for its parameters.
Have a look at the first parameter: lpBits2 is a pointer to BYTE(s) which is an
address by itself, but lpBits2[i] is a BYTE and lpBits2[i][tmpY] is simply not
a valid indexed expression and most certainly doesn't resolve to an address.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tamir Khason |
last post by:
Assist,
I have different images wich I have to compare. Tnx to Bob, did it in unsafe
blocks and it even works :) , BUT -> of couse I recieve buffer oveflows
often.
Checked the code and there is...
|
by: Mark Evans |
last post by:
I have a dialog box and on it I want to display a bitmap, which will
change at various times during the program. My problem is that the
bitmaps will not be the same each time. I want the user to...
|
by: Pete Davis |
last post by:
I'm having trouble dealing with bitmaps larger than about 10,000 pixels in
either direction.
I've tried using DrawImage and DrawImageUnscaled, but both give me out of
memory errors.
In my...
|
by: Dino M. Buljubasic |
last post by:
I would like to be able to compare BackgroundImage Property of two picture
boxes on my form.
How can I do that?
I am using :
if (pctOne.BackgroundImage Is pctTwo.BackgroundImage) then
//...
|
by: Nikolay Petrov |
last post by:
I need to compare to byte values, but one of them may differ from the
other by let's say 5%, and they still should count as same.
I need a fast method, because i am going to compare a set of about...
|
by: Mike |
last post by:
Hello everybody.
I am drawing a country map that consists of 149 municipality bitmaps, each
around 25 Kb. I draw it onto the in-memory bitmap, then draw it on the
picture box.
I use C++, but...
|
by: Fir5tSight |
last post by:
Hi All,
I have two identical PDF files, say file1 and file2. I used an API
package to extract the bitmap in each PDF file, say bitmap1 (in file1)
and bitmap2 (in file2). Since the bitmaps are...
|
by: grey |
last post by:
does anyone suggest me how to write a windows application for comparing two
pdf content. The requirement is very easy... i only need to inform user two
pdf are differnet, no need to spot where the...
|
by: nkumarin001 |
last post by:
Hi,
Can anyone help me in this matter:-
When i was studying locally managed tablespaces i came across bitmaps that are used in locally managed tablespaces it stated that:-
"Locally...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |