Hack Forums
[C#] Motion Detection Block Matching - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Motion Detection Block Matching (/showthread.php?tid=4380786)



Motion Detection Block Matching - Nov - Aug 6, 2014

I am currently developing software using the AForge framework. I am trying to write a method to calculate the mean square error http://www.mathworks.co.uk/help/vision/ref/blockmatching.html

Any advice?


* - Fjux - Aug 6, 2014

i must say,

if you look at the link you gave and the code.

the code is a very simple calculation. but the formula on the website is quite more complex.
At this moment to tierd to check if you formula is working.

But i know that your code probbally is slow as hell, this is because C# is standard in "safe mode" and it will slow down image proccessing a lot.

i suggest you start looking into C++ or create a class that is unsafe (contains C++ like code) to calculate these things. it will speed up the calculation by around a factor 100, if not more.

also, i've found this document about Blockmatching: https://software.intel.com/sites/default/files/m/d/4/1/d/8/3430.pdf?wapkw=pentium+book

and it has example code in C++, maby you can use that.

but i think the Aforge framework will do everything in "unsafe mode" But you are not utilizing that.
It only asks for a pixels brightness, and then calculate something. getting a value won't matter that much in safe or unsafe mode, but the calculation probably will ;)

i hope it helped a bit!


* - Dispersia - Aug 6, 2014

(Aug 6, 2014 09:30 AM)Fjux Wrote:  i suggest you start looking into C++ or create a class that is unsafe (contains C++ like code) to calculate these things. it will speed up the calculation by around a factor 100, if not more.

a class doesn't have to be unsafe to utilize native code. Anyway, you're in C#, stick to C# if possible. Yes, how it works normally is very slow scanning like that, but simply call lockbits. There is no need for C++ to do something like this.


* - 0xDEAD10CC - Aug 6, 2014

(Aug 6, 2014 07:12 PM)Dispersia Wrote:  a class doesn't have to be unsafe to utilize native code. Anyway, you're in C#, stick to C# if possible. Yes, how it works normally is very slow scanning like that, but simply call lockbits. There is no need for C++ to do something like this.

He never said to use C++ code, he just mentioned that it's more C++-like code when using unsafe context and pointers I would assume. Even though that's not really true, it would be more C-like, because in C++ you typically stay away from pointers for the most part.


* - PENISSMELLSLIKEFISH - Aug 6, 2014

(Aug 6, 2014 08:34 PM)0xDEAD10CC Wrote:  He never said to use C++ code, he just mentioned that it's more C++-like code when using unsafe context and pointers I would assume. Even though that's not really true, it would be more C-like, because in C++ you typically stay away from pointers for the most part.

C is for real programmers that use loop and not strlen

https://hackforums.net/showthread.php?tid=4382069


* - 0xDEAD10CC - Aug 6, 2014

(Aug 6, 2014 08:44 PM)PENISSMELLSLIKEFISH Wrote:  C is for real programmers that use loop and not strlen

https://hackforums.net/showthread.php?tid=4382069

Ahh, so excluding you, you mean? I get it now. It's also a language used by people who know what the difference between a debug and release config are.

Btw:
Code
@"\\.\PhysicalDrive0"

;)


* - PENISSMELLSLIKEFISH - Aug 6, 2014

(Aug 6, 2014 09:13 PM)0xDEAD10CC Wrote:  Ahh, so excluding you, you mean? I get it now.

Is your interpreter not beside you?


* - 0xDEAD10CC - Aug 6, 2014

(Aug 6, 2014 09:14 PM)PENISSMELLSLIKEFISH Wrote:  Is your interpreter not beside you?

Who needs one when you have a compiler. ;) You must.


* - d3agle - Aug 6, 2014

(Aug 6, 2014 09:13 PM)0xDEAD10CC Wrote:  Ahh, so excluding you, you mean? I get it now. It's also a language used by people who know what the difference between a debug and release config are.

Btw:
Code
@"\\.\PhysicalDrive0"

;)

Code
\\\\.\\PhysicalDrive0

This looks fancier though, so many slashes


* - PENISSMELLSLIKEFISH - Aug 6, 2014

(Aug 6, 2014 09:13 PM)0xDEAD10CC Wrote:  Ahh, so excluding you, you mean? I get it now. It's also a language used by people who know what the difference between a debug and release config are.

Btw:
Code
@"\\.\PhysicalDrive0"

;)

you think i got time for that disable debug info bullshit i program in 2008 express