Click here to Skip to main content
12,760,014 members (32,132 online)
   

C#

 
AnswerRe: problem with using pointers in C# Pin
Abhinav S12-Dec-12 6:04
mvpAbhinav S12-Dec-12 6:04 
AnswerRe: problem with using pointers in C# Pin
OriginalGriff12-Dec-12 6:06
mvpOriginalGriff12-Dec-12 6:06 
AnswerRe: problem with using pointers in C# Pin
DaveyM6912-Dec-12 9:08
mentorDaveyM6912-Dec-12 9:08 
AnswerRe: problem with using pointers in C# Pin
Member 857512112-Dec-12 11:57
memberMember 857512112-Dec-12 11:57 
QuestionValue of label is not changing upon loading or changing the value of the combobox Pin
jon-8012-Dec-12 5:37
memberjon-8012-Dec-12 5:37 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox Pin
Eddy Vluggen12-Dec-12 5:42
memberEddy Vluggen12-Dec-12 5:42 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox Pin
Freak3012-Dec-12 5:52
memberFreak3012-Dec-12 5:52 
QuestionApply diff image on the original image c# Pin
Tridip Bhattacharjee12-Dec-12 1:22
memberTridip Bhattacharjee12-Dec-12 1: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# Pin
Tridip Bhattacharjee12-Dec-12 1:21
memberTridip Bhattacharjee12-Dec-12 1:21 
AnswerRe: Two image compare using win32 api c# Pin
Pete O'Hanlon12-Dec-12 2:01
protectorPete O'Hanlon12-Dec-12 2:01 
QuestionCode does not appear to be called when program is run Pin
bikerben12-Dec-12 1:07
memberbikerben12-Dec-12 1:07 
AnswerRe: Code does not appear to be called when program is run Pin
Pete O'Hanlon12-Dec-12 2:06
protectorPete O'Hanlon12-Dec-12 2:06 
GeneralRe: Code does not appear to be called when program is run Pin
bikerben12-Dec-12 2:23
memberbikerben12-Dec-12 2:23 
GeneralRe: Code does not appear to be called when program is run Pin
Pete O'Hanlon12-Dec-12 3:25
protectorPete O'Hanlon12-Dec-12 3:25 
SuggestionRe: Code does not appear to be called when program is run Pin
Richard MacCutchan12-Dec-12 4:07
mvpRichard MacCutchan12-Dec-12 4:07 
GeneralRe: Code does not appear to be called when program is run Pin
bikerben12-Dec-12 4:12
memberbikerben12-Dec-12 4:12 
GeneralRe: Code does not appear to be called when program is run Pin
Alan N12-Dec-12 4:07
memberAlan N12-Dec-12 4:07 
QuestionTFS and WIX Pin
Pascal Ganaye11-Dec-12 23:33
memberPascal Ganaye11-Dec-12 23:33 
QuestionCanny edge detection in c# Pin
neha198711-Dec-12 23:11
memberneha198711-Dec-12 23:11 
AnswerRe: Canny edge detection in c# Pin
Simon_Whale11-Dec-12 23:23
memberSimon_Whale11-Dec-12 23:23 
AnswerRe: Canny edge detection in c# Pin
Pete O'Hanlon11-Dec-12 23:34
protectorPete O'Hanlon11-Dec-12 23:34 
QuestionWCF Services in a multi threaded application results in Oracle Connection request Timed out error Pin
rajaron11-Dec-12 22:56
memberrajaron11-Dec-12 22:56 
AnswerRe: WCF Services in a multi threaded application results in Oracle Connection request Timed out error Pin
Eddy Vluggen12-Dec-12 4:05
memberEddy Vluggen12-Dec-12 4:05 
GeneralRunning code as different user Pin
MacUseless11-Dec-12 22:35
memberMacUseless11-Dec-12 22:35 
SuggestionRe: Running code as different user Pin
Richard Deeming12-Dec-12 2:51
memberRichard Deeming12-Dec-12 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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.170217.1 | Last Updated 24 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid