|
This is going to be horribly slow. You should read my image processing articles to see how you should be accessing the bits of your image.
eng:haitham wrote: i want to passing a picture to this method and having the modified picture,.........how can this task accomplished
i will be grateful if the answer be in code
Your question does not make sense - what do you want ? Why are you passing in a ref Bitmap and returning void, wouldn't returning the bitmap be easier ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
eng:haitham wrote: this method making edge detection for the face
Are you following a specific algorithim? If not I am not sure your approach to doing it by detecting edges will be a feasible approach[versus using it as a stepping stone]. From your previous post its not clear if your trying to match faces or detect them. One method you might want to look at is eigenfaces. Here is a paper about it if you don't mind the math[^] It should come out to about a page of matlab code.
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
first i would like to thank u about ur help and i want to tell u that i changed the algorithm to that code
public static void DetectSkin(Bitmap original, ref Bitmap modified)<br />
{<br />
Graphics g = Graphics.FromImage(original);<br />
ArrayList points = new ArrayList();<br />
for(Int32 x = 0; x < original.Width; x++)<br />
{<br />
for(Int32 y = 0; y < original.Height; y++)<br />
{<br />
<br />
<br />
Color c = modified.GetPixel(x, y);<br />
<br />
double I = (Math.Log(c.R) + Math.Log(c.B) + Math.Log(c.G)) / 3;<br />
double Rg = Math.Log(c.R) - Math.Log(c.G);<br />
double By = Math.Log(c.B) - (Math.Log(c.G) + Math.Log(c.R)) / 2;<br />
double hue = Math.Atan2(Rg, By) * (180 / Math.PI);<br />
<br />
<br />
<br />
<br />
if (I <= 5 && (hue >= 4 && hue <= 255))<br />
{<br />
points.Add(new Point(x, y));<br />
} <br />
else<br />
{<br />
modified.SetPixel(x, y, Color.Black);<br />
}<br />
<br />
<br />
}<br />
}<br />
}
but the output was not good (i.e the modified picture has black regions from the light)
do u have a solution to prevent this regions but plz i don't want the solution be in the environment i want the solution in code ...if u know any article regarding this problem plz tell me
thanks to u in advance
haitham
|
|
|
|
|
Hi, Has anyone experienced this problem?
by VS2005 C#, i had made class library project contains custom control called "DynamicPanel" inherited from System.Windows.Forms.Panel, this "DynamicPanel" contains some child controls ..
now in my WindowsApplicationProject --> Form1 i'm Draging "DynamicPanel" from the toolbox and all properties was found in PropertyGrid ..
my problem is: i want to be able to access the properties of any of the child controls in "DynamicPanel" by selecting them ( by clicking on them ) in design time. how can i do that?
I would appreciate your help ...
|
|
|
|
|
How To change a user's group or account type in c# (or command line)?
|
|
|
|
|
In Visual Stdio 2005, the "WebBrowser" control. How can i get the url of user
clicked?
void CurrentBrowser_NewWindow(object sender, CancelEventArgs e)
{
e.Cancel = true;
//i want to get the url of user clicked to open the web in
//my own browser
string url = ???
this.CurrentBrowser.Navigate( url )
}
THANK YOU
|
|
|
|
|
Hello,
Is it possible to get a progress value of any method in general which can be used in progresbar control ? I mean, I have some method which takes long time and in the mean time method is being executed, I want to show the user about the percentage of done work ( of that method ).
Is it a solution if i think about using background worker if in these cases ? If so, then how do a background worker know how much work is still left before it finishes it's work ?
thanks and regards
Emran
|
|
|
|
|
There is a very easy way to show the progress of your method into a progress bar : decide into your method when the progress bar should be incremented (note that at the exit of the procedure the progress bar should have reached the max value).
In order to obtain a continous effect, you should run the method that affect the progress bar into a worker thread.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Is it possible to add the 'events' tab in a property grid just like the the actual properties pane in Visual Studio .NET.
|
|
|
|
|
I need to count the number of forms in a C# project. One solution to this is to parse the '.csproj' file which is xml. There is a tag called 'subtype' which represents a form, so a counter can be incremented each time a subtype tag is obtained, but i need the exact name of the form (i.e the string which is entered in the 'name' property of the form) so that i can create an object of that particular form. What the '.csproj' xml represents under the sybtype tag is the name of the form in solution explorer (e.g if one form is 'Form1.cs' in the solution explorer, even if the 'name' property of that form is changed, it is not reflected in the xml so the exact form name is not know and hence instantiating it becomes a problem.). The problem is that changing the 'name' property of a form does not change the name of the actual corresponding 'Form.cs' file in solution explorer.
Any suggestions
|
|
|
|
|
Anyone know how to read memory? I have heard pointers, but the articles I have seen do too much with them are are written poorly(not on codeproject). I know this isn't a rent-a-coder, but if someone wouldn't mind posting a code snipit that simply read the number out of a specfic memory address, that would be great, if not a link to a good web site.
|
|
|
|
|
This example just declares an integer value of 5 and uses a pointer to access the memory that 5 is in and display it.
<br />
int number = 5;<br />
<br />
unsafe<br />
{<br />
int * pointer;<br />
<br />
pointer = &number;<br />
<br />
Console.Write(*pointer);<br />
}
Hope that helps. Pointers are not very common in C# (I dont see them much anyway) but more so in C++.
Try checking out some C++ articles on pointers. The syntax is pretty much identical.
|
|
|
|
|
I have linkLabel on my UC (that I have created) and everything is ok if background is solid, but when it's gradient, it's not very pretty.
Can I somehow set the background of linkLabel to transparent (I've tried to set on Transparent, but I couldn't, VS.NET was complaining that this is an invalid color).
Is there any way to achive this?
|
|
|
|
|
Try adding the following line of code into your user control's constructor, after the InitializeComponents() call.
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
|
|
|
|
I've added this line and when I set the background of labelControl to Transparent, VS.NET complains about invalid parameter used or Iam using the wrong approach?!
|
|
|
|
|
Is there error occuring in the designer or when you are compiling your code?
If it's a compiler error, then show us the line of code it's tripping up on.
|
|
|
|
|
I have added code you tell me to add in UC's constructor.
When I drag and drop the linkLabel on to the UC everything is OK.
When I set the back color to transparent, VS.NET complains about Invalid parameter used.
If I click OK and just ignore the error I get error displaying on linkLabel.
When I try to compile, I get same error, but in Output everything is ok - Build succeed, no warnings.
If I ignore it again and run it, I get this same error.
|
|
|
|
|
The problem is that the standard LinkLabel doesn't have the control style SupportsTransparentBackColor set, so you'll get the InvalidParameterException .
Usually you set these styles in the constructor of your control.
So what you really would have to do is to create a new class that inherits from LinkLabel :
public class MyLinkLabel : LinkLabel
{
public MyLinkLabel() : base()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
}
} Now, when you use your MyLinkLabel you won't get the error message when you assign Transparent as background color.
Don't know how the painting works, though. Could be that the link label doesn't paint itself properly when it's been assigned a transparent back color. In this case you'd have to override OnPaintBackground() and/or OnPaint() .
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanks mate. I will try to do something about it.
It's not very important. It can wait. It is, if I use gradient color.
-- modified at 11:33 Monday 20th February, 2006
|
|
|
|
|
Hi everybody.
Currently I'm developing a mechanism to load other C# dlls so that they can act as plugins for my application. This is what I have so far, the code is inside a DLL which is loaded by a different C# app again:
Assembly dll = Assembly.FromFile(filename);
Type entry = dll.GetType("PluginTest.Entry");
Entry start = (Entry)Activator.CreateInstance(entry);
start.Go();
This loads the dll filename , loads the Entry class from namespace PluginTest and executes the method Go() .
This works fine in my test-solution where all files reside in the same folder.
Now comes the awkward part: If I move my DLLs (the reflection loader and the plugin dll) to a different folder, then suddenly the dll.GetType() part fails with an ArgumentException .
Can someone tell my what's wrong with my code here when everything works fine in my testing "sandbox"? It's not the LoadFile part which is failing from outside this scenario, as I think
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Did you try Assembly.Load() instead? It works for me when the plugin is not in the same folder.
I assume you have interface setup for the class, right?
-- modified at 20:57 Saturday 18th February, 2006
[edit] Sorry, I was looking at wrong part of the code, Assembly.Load() was used to check whether the plugin can be loaded. this is where the assembly is really loaded on my app:
Type ObjType=null;
Assembly assembly = null;
assembly = Assembly.LoadFrom(path); <---- full path
if(assembly != null)
{
ObjType = assembly.GetType("you.class.here");
}
if(ObjType != null)
{
object[] args = new object[2];
args[0] = cm;
args[1] = catalog;
this.database = (IDatabaseInterface)Activator.CreateInstance(ObjType, args);
}
-- modified at 21:02 Saturday 18th February, 2006
[edit again]
Some other stuff that I found after 2 painful days of trial and error
1. Have an interface for the class
2. You must put the interface class in a seperate assembly. Putting it in your main assembly won't work.
3. You have to keep the assemblyversion (main, interface, the plugins) a constant and may need to sign the assembly too.
|
|
|
|
|
DarkElv wrote: Some other stuff that I found after 2 painful days of trial and error
1. Have an interface for the class
2. You must put the interface class in a seperate assembly. Putting it in your main assembly won't work.
3. You have to keep the assemblyversion (main, interface, the plugins) a constant and may need to sign the assembly too.
thanks so far for the detailed description! This looks like a rather painful procedure just for some reflection code. Isn't there something simple like GetProcAddress() for .NET?
1) Entry is actually an interface
2) it's defined in the same assembly where the reflection code is
3) what's the deal with the assembly version and signature?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You can't create an instance of an interface.
---
b { font-weight: normal; }
|
|
|
|
|
Yeah, I used the an article here describing how to make a plugin, and then I encountered the same problem that you have when I move the dll to some other folder. So ended up I search various news groups and finally make it worked.
Along the way I read something about the assembly version, and if the interface is included in the main assembly, and you creates another dll that includes the interface in that dll, they will be considered 2 different interface, as everytime you compile them, a new version and new guid will be generated. I didn't bother to see if not making the version and signature the same still work as it is working now
So for (2), make a standalone dll for the interface and reference it in both your main and your plugin.
|
|
|
|
|
DarkElv wrote: So for (2), make a standalone dll for the interface and reference it in both your main and your plugin.
Just did that. My testing "sandbox" still works like a charm, but outside now I get a FileNotFoundException which says File or assembly EntryInterface could not be found... .
These files are all in the same directory:
- Entry.exe (loading the reflection dll)
- EntryLoader.dll (doing the reflection stuff)
- EntryInterface.dll (defining the interface class)
- SomePluginDLL.dll
SomePluginDLL and EntryLoader.dll both have a reference to EntryInterface.dll, but this way I get a FileNotFoundException outside of my testing scenario.
Thanks for your effords so far
regards
modified 12-Sep-18 21:01pm.
|
|
|
|