Click here to Skip to main content
       

C#

 
AnswerRe: problem with using pointers in C# PinmvpAbhinav S12-Dec-12 5:04 
AnswerRe: problem with using pointers in C# PinmvpOriginalGriff12-Dec-12 5:06 
AnswerRe: problem with using pointers in C# PinmentorDaveyM6912-Dec-12 8:08 
AnswerRe: problem with using pointers in C# PinmemberMember 857512112-Dec-12 10:57 
QuestionValue of label is not changing upon loading or changing the value of the combobox Pinmemberjon-8012-Dec-12 4:37 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox PinmemberEddy Vluggen12-Dec-12 4:42 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox PinmemberFreak3012-Dec-12 4:52 
QuestionApply diff image on the original image c# PinmemberTridip Bhattacharjee12-Dec-12 0:22 
suppose i have two image with same height and width. pic1.jpg & pic2.jpg. two image look pretty same with minimum difference. with the help of below routine we can get the difference between two images.this below routine is not my routine.
 
public class ImageDifferences
{
private static ILog mLog = LogManager.GetLogger("ImageDifferences");
 
public static unsafe Bitmap PixelDiff(Image a, Image b)
{
if (!a.Size.Equals(b.Size)) return null;
if (!(a is Bitmap) || !(b is Bitmap)) return null;
 
return PixelDiff(a as Bitmap, b as Bitmap);
}
 
public static unsafe Bitmap PixelDiff(Bitmap a, Bitmap b)
{
Bitmap output = new Bitmap(
Math.Max(a.Width, b.Width),
Math.Max(a.Height, b.Height),
PixelFormat.Format32bppArgb);
 
Rectangle recta = new Rectangle(Point.Empty, a.Size);
Rectangle rectb = new Rectangle(Point.Empty, b.Size);
Rectangle rectOutput = new Rectangle(Point.Empty, output.Size);
 
BitmapData aData = a.LockBits(recta, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
BitmapData bData = b.LockBits(rectb, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
BitmapData outputData = output.LockBits(rectOutput, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
 
try
{
byte* aPtr = (byte*)aData.Scan0;
byte* bPtr = (byte*)bData.Scan0;
byte* outputPtr = (byte*)outputData.Scan0;
int len = aData.Stride * aData.Height;
 
for (int i = 0; i < len; i++)
{
// For alpha use the average of both images (otherwise pixels with the same alpha won't be visible)
if ((i + 1) % 4 == 0)
*outputPtr = (byte)((*aPtr + *bPtr) / 2);
else
*outputPtr = (byte)~(*aPtr ^ *bPtr);
 
outputPtr++;
aPtr++;
bPtr++;
}
 
return output;
}
catch (Exception ex)
{
 
return null;
}
finally
{
a.UnlockBits(aData);
b.UnlockBits(bData);
output.UnlockBits(outputData);
}
}
}
}
 
after getting the difference how could i merge the difference on first image.
 
this below way we can merge
 
using (Graphics grfx = Graphics.FromImage(image))
{
grfx.DrawImage(newImage, x, y)
}
 
but we need to know the x & y from where the new image will be drawn on first image. can any one tell me how can i get the x & y position from the above routine called PixelDiff() thanks in advance.
tbhattacharjee

QuestionTwo image compare using win32 api c# PinmemberTridip Bhattacharjee12-Dec-12 0:21 
AnswerRe: Two image compare using win32 api c# PinprotectorPete O'Hanlon12-Dec-12 1:01 
QuestionCode does not appear to be called when program is run Pinmemberbikerben12-Dec-12 0:07 
AnswerRe: Code does not appear to be called when program is run PinprotectorPete O'Hanlon12-Dec-12 1:06 
GeneralRe: Code does not appear to be called when program is run Pinmemberbikerben12-Dec-12 1:23 
GeneralRe: Code does not appear to be called when program is run PinprotectorPete O'Hanlon12-Dec-12 2:25 
SuggestionRe: Code does not appear to be called when program is run PinmvpRichard MacCutchan12-Dec-12 3:07 
GeneralRe: Code does not appear to be called when program is run Pinmemberbikerben12-Dec-12 3:12 
GeneralRe: Code does not appear to be called when program is run PinmemberAlan N12-Dec-12 3:07 
QuestionTFS and WIX PinmemberPascal Ganaye11-Dec-12 22:33 
QuestionCanny edge detection in c# Pinmemberneha198711-Dec-12 22:11 
AnswerRe: Canny edge detection in c# PinmemberSimon_Whale11-Dec-12 22:23 
AnswerRe: Canny edge detection in c# PinprotectorPete O'Hanlon11-Dec-12 22:34 
QuestionWCF Services in a multi threaded application results in Oracle Connection request Timed out error Pinmemberrajaron11-Dec-12 21:56 
AnswerRe: WCF Services in a multi threaded application results in Oracle Connection request Timed out error PinmemberEddy Vluggen12-Dec-12 3:05 
GeneralRunning code as different user PinmemberMacUseless11-Dec-12 21:35 
SuggestionRe: Running code as different user PinmemberRichard Deeming12-Dec-12 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 26 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid