full code for comparing bitmaps
-
can anyone send me full code for comparing two bitmaps... thank you..
-
can anyone send me full code for comparing two bitmaps... thank you..
No problem. What's your preferred method of payment? PayPal?
-
No problem. What's your preferred method of payment? PayPal?
sry my friend.. i have account on paypal but i have not done any work yet due to busy in college..but if you can provide me the code for this i will be very thankful to you.. rest is your wish..thanks for the reply..
-
can anyone send me full code for comparing two bitmaps... thank you..
if (bitmap1 == bitmap2)
BTW Don't forget to visit www.cpallini.freeproductz.com for more free 'full code'. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
if (bitmap1 == bitmap2)
BTW Don't forget to visit www.cpallini.freeproductz.com for more free 'full code'. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]:laugh:
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]
-
:laugh:
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]
Damnit, you're so fast! :rolleyes: :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
if (bitmap1 == bitmap2)
BTW Don't forget to visit www.cpallini.freeproductz.com for more free 'full code'. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]pallini..thnx..but i need a full running code for comparing 2 bitmaps.. i have posted my code but i cant understand what is wrong in my code... can you help please.. 1. void CPixelView::OnDraw(CDC* pDC) { CPixelDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here { COLORREF color[255][255],color1[255][255]; CBitmap bitmap,bitmap1; CString file1,file2,strText; file1.Format("C:\\1.bmp"); file2.Format("C:\\3.bmp"); CDC dcMemory,dcMemory1; int r[255][255],R[255][255]; // 1st image HBITMAP hBitmap1 = (HBITMAP)::LoadImage(NULL,file1,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE );//| LR_CREATEDIBSECTION); //2nd image HBITMAP hBitmap2 = (HBITMAP)::LoadImage(NULL,file2,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE ); // Attach the loaded image to the CBitmap object. bitmap.Attach(hBitmap1); bitmap1.Attach(hBitmap2); dcMemory.CreateCompatibleDC(pDC); dcMemory.SelectObject(&bitmap); dcMemory1.CreateCompatibleDC(pDC); dcMemory1.SelectObject(&bitmap1); pDC->BitBlt(0,0,200,200,&dcMemory,0,0,SRCCOPY); pDC->BitBlt(0,0,300,700,&dcMemory1,0,0,SRCCOPY); //for all the pixels for(int i=0;i<48;i++) { for(int j=0;j<48;j++) { HDC hDC = ::GetDC(this->GetSafeHwnd()); color[i][j] = ::GetPixel(hDC,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC); r[i][j]=GetRValue(color[i][j]); HDC hDC1 = ::GetDC(this->GetSafeHwnd()); color1[i][j] = ::GetPixel(hDC1,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC1); R[i][j]=GetRValue(color1[i][j]); } }//got the pixel values } }
-
sry my friend.. i have account on paypal but i have not done any work yet due to busy in college..but if you can provide me the code for this i will be very thankful to you.. rest is your wish..thanks for the reply..
Read the guidelines[^] before you make another post. For once, what is pissing me off is your TXSTPK. Stop using SMS language here. Hundreds of people read it every day. So, act like a professional.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]
-
pallini..thnx..but i need a full running code for comparing 2 bitmaps.. i have posted my code but i cant understand what is wrong in my code... can you help please.. 1. void CPixelView::OnDraw(CDC* pDC) { CPixelDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here { COLORREF color[255][255],color1[255][255]; CBitmap bitmap,bitmap1; CString file1,file2,strText; file1.Format("C:\\1.bmp"); file2.Format("C:\\3.bmp"); CDC dcMemory,dcMemory1; int r[255][255],R[255][255]; // 1st image HBITMAP hBitmap1 = (HBITMAP)::LoadImage(NULL,file1,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE );//| LR_CREATEDIBSECTION); //2nd image HBITMAP hBitmap2 = (HBITMAP)::LoadImage(NULL,file2,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE ); // Attach the loaded image to the CBitmap object. bitmap.Attach(hBitmap1); bitmap1.Attach(hBitmap2); dcMemory.CreateCompatibleDC(pDC); dcMemory.SelectObject(&bitmap); dcMemory1.CreateCompatibleDC(pDC); dcMemory1.SelectObject(&bitmap1); pDC->BitBlt(0,0,200,200,&dcMemory,0,0,SRCCOPY); pDC->BitBlt(0,0,300,700,&dcMemory1,0,0,SRCCOPY); //for all the pixels for(int i=0;i<48;i++) { for(int j=0;j<48;j++) { HDC hDC = ::GetDC(this->GetSafeHwnd()); color[i][j] = ::GetPixel(hDC,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC); r[i][j]=GetRValue(color[i][j]); HDC hDC1 = ::GetDC(this->GetSafeHwnd()); color1[i][j] = ::GetPixel(hDC1,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC1); R[i][j]=GetRValue(color1[i][j]); } }//got the pixel values } }
kaushal kishore sharma wrote:
allini..thnx..but i need a full running code for comparing 2 bitmaps
He just posted the code.
-
if (bitmap1 == bitmap2)
BTW Don't forget to visit www.cpallini.freeproductz.com for more free 'full code'. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Ingenious. ;)
-
Read the guidelines[^] before you make another post. For once, what is pissing me off is your TXSTPK. Stop using SMS language here. Hundreds of people read it every day. So, act like a professional.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]
Rajesh R Subramanian wrote:
For once, what is pissing me off is your TXSTPK
You forgot the
ASAP
andURGENTZZ
-
pallini..thnx..but i need a full running code for comparing 2 bitmaps.. i have posted my code but i cant understand what is wrong in my code... can you help please.. 1. void CPixelView::OnDraw(CDC* pDC) { CPixelDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here { COLORREF color[255][255],color1[255][255]; CBitmap bitmap,bitmap1; CString file1,file2,strText; file1.Format("C:\\1.bmp"); file2.Format("C:\\3.bmp"); CDC dcMemory,dcMemory1; int r[255][255],R[255][255]; // 1st image HBITMAP hBitmap1 = (HBITMAP)::LoadImage(NULL,file1,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE );//| LR_CREATEDIBSECTION); //2nd image HBITMAP hBitmap2 = (HBITMAP)::LoadImage(NULL,file2,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE ); // Attach the loaded image to the CBitmap object. bitmap.Attach(hBitmap1); bitmap1.Attach(hBitmap2); dcMemory.CreateCompatibleDC(pDC); dcMemory.SelectObject(&bitmap); dcMemory1.CreateCompatibleDC(pDC); dcMemory1.SelectObject(&bitmap1); pDC->BitBlt(0,0,200,200,&dcMemory,0,0,SRCCOPY); pDC->BitBlt(0,0,300,700,&dcMemory1,0,0,SRCCOPY); //for all the pixels for(int i=0;i<48;i++) { for(int j=0;j<48;j++) { HDC hDC = ::GetDC(this->GetSafeHwnd()); color[i][j] = ::GetPixel(hDC,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC); r[i][j]=GetRValue(color[i][j]); HDC hDC1 = ::GetDC(this->GetSafeHwnd()); color1[i][j] = ::GetPixel(hDC1,i,j); ::ReleaseDC(this->GetSafeHwnd(), hDC1); R[i][j]=GetRValue(color1[i][j]); } }//got the pixel values } }
Well, you're "getting there"; Me thing you do not need to keep arrays of COLORREF or the r and R arrays You should be able to get the size of the bitmaps dynamically (because a bitmap of 48 pixel is really small) No need to get the DC twice. Now that you have the color for the same pixel position in both bitmaps; what should you be doing with them ? compare them ? maybe ?
This signature was proudly tested on animals.
-
can anyone send me full code for comparing two bitmaps... thank you..
-
if (bitmap1 == bitmap2)
BTW Don't forget to visit www.cpallini.freeproductz.com for more free 'full code'. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]:laugh: And can we use of this code for other formats like jpg? :laugh:
-
can anyone send me full code for comparing two bitmaps... thank you..
Of course you can use of CImage class for read your bitmap files and like your code you can use of two loop(See CImage::GetPixel) I think its easy than your code.
-
Well, you're "getting there"; Me thing you do not need to keep arrays of COLORREF or the r and R arrays You should be able to get the size of the bitmaps dynamically (because a bitmap of 48 pixel is really small) No need to get the DC twice. Now that you have the color for the same pixel position in both bitmaps; what should you be doing with them ? compare them ? maybe ?
This signature was proudly tested on animals.
thank you for the reply. can you tell how to make changes in the code. I am studying VC++ so not too much knowledge about the language.So can you help me with the code. Yes i am comparing both bitmap for checking whether both images are same or different. Thank You kaushal kishore Sharma kaushal..
-
can anyone send me full code for comparing two bitmaps... thank you..
-
:laugh: And can we use of this code for other formats like jpg? :laugh:
Hamid. wrote:
And can we use of this code for other formats like jpg?
Nope. You have to change it:
if ( jpegImage1 == jpegImage2) ...
Details for all image formats on www.cpallini.freeproductz.com. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hamid. wrote:
And can we use of this code for other formats like jpg?
Nope. You have to change it:
if ( jpegImage1 == jpegImage2) ...
Details for all image formats on www.cpallini.freeproductz.com. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]I decided to made a supplement for your magic site. :-D