|
mikefl wrote: binarize
Pardon? What are you trying to do here? Convert it to a byte stream? If so, you may want to try
public byte[] ConvertImage(Image image)
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Gif);
return ms.ToArray();
}
}
|
|
|
|
|
Thanks for the comment. I have a grayscale image. I need to binarize it so that it looks pretty decent. I tried converting it to 1 bit black and white and many of the parts of the image are complete white or black. I need to basically get one grayscale image and convert it into a nice binarized copy of it that's black and white (no gray pixels) but not smudged.
Any ideas?
|
|
|
|
|
I don't understand exactly what you are trying to do. Anyway:
Grayscale means that each pixel will have equal values for R,G and B.
Usually, that value will be (R + G + B) / 3 for the current pixel.
Binarization means that each pixel will either be black or white.
pseudocode:
foreach pixel in image<br />
{<br />
int greyValue = (R + G + B) / 3;<br />
if(greyValue >= threshold)<br />
setPixel(255, 255, 255);
else<br />
setPixel(0, 0, 0);
}
|
|
|
|
|
what would be a good working version of that code? Is there anything online that I can look at that's functional?
|
|
|
|
|
I think Christian Graus has a collection of articles on Image processing here on CP. The grayscale effect is always the first one demonstrated because it's very easy do understand and implement.
|
|
|
|
|
I created a service and its installer.
However the installed service doesn't work.
Why? Windows Firewall block the port my service is listening too.
If, as an administrator, I add my application to the list of app authorized by the firewall that's all good, however I would much prefer if the installer do that for me.
Question: How could I add my app to the authorized application list by the firewall in my installer?
|
|
|
|
|
Hello,
I would like to confirm whether you have started the Service in the services folder.
Running a service and starting a service are two different things. We have to start it after
installing it.
1. To view and start the service, open Control Panel > Administrative Tools.
2. Now click Services, locate the service, right click on it and select 'Start' to start the service.
3. To make it running all the time, change the 'StarttupType' to "Automatic".
I hope this helps.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
I confirm, it is started.
As a clue to that (for you), I just need to (manually ) add my exe to the authorized list of Windows Firewall for it to work properly!
Now my concern remain, I want to write a proper installer, which will relieve the admin of the burden of having to manually add my service to the authorized list of the windows firewall...
|
|
|
|
|
How to execute other "setup.exe" during installation?
EX:I execute Setup.exe(Setup.msi),when finish its task, not exit;
keep on and execute "aa.exe" and "bb.msi".
When "aa.exe" and "bb.msi" finished, clue to setup finish.
How to make a SetupProgram like this?
Thanks.
|
|
|
|
|
Read the class documentation for the (System.Configuration.Install.)Installer class, that should give you a good start.
|
|
|
|
|
Hello,
I need to send a message hashed by a private key. The first confusion in the whole process is: Do I need to Install certificate on my web server?
Second how should I do it. I saw various links and they say I need to Install the certificate on my system. Please guide me with the examples.Any help is appreciated.
My Private key has extension ".key"
And certificate has extension ".crt"
For example:
http://kbalertz.com/901183/service-using-client-certificate-authentication-application.aspx
Regards,
Pavas
|
|
|
|
|
Hello guys,
I have a small project that I'm trying to accomplish but I can't figure out which way would be easier and more efficient. I'm sure there's a lot of people here that will have more experience than me in this field, so here goes:
I'm basically trying to program an application in C# that will take a bunch of JPEG's and AVI's/MPEG's and then output those files into one big AVI file which shows all those jpeg's and videos in sequence, sort of like a slide show except in a video format. It's kind of close to the Movie Maker application on Windows XP.
I'm not sure how I should implement this. Some have said that I should use VFW, which I know is a sort of an obsolete technology. Some have told me that it's doable in DirectX but I can't find any information on video creation or production in DirectX. DirectShow is also another option but someone had told me that it's impossible to show multiple files on one filter during runtime. Multiple instances would have to be muxed to an output filter, which sounds like a memory-monster idea.
Any help or suggestions would be extremely appreciated
Cheers
|
|
|
|
|
What you really need is DirectShow Editing Services, the technology behind MovieMaker.
|
|
|
|
|
Hi all,I need arrange this code into an array.This is the codes.
string hex2 = "023";
string hex1 = "025";
string hex = "040";
int code = Convert.ToInt32(hex, 16);
int code1 = Convert.ToInt32(hex1, 16);
int code2 = Convert.ToInt32(hex2, 16);
Pls help me.Thank You.
KAM83_CODEPROJECT
|
|
|
|
|
make a string array of 3 dimension, then set the values in all 3 dimension, e.g. myString[XX] = ??; where XX is dimension 0 based index
do the same with integers
and please do your homework yourself, google is your friend
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hey guys I am hoping you can help with this.
I am writting a windows service that monitors servers and reports back to an asp page which collects the data and displays it in a grid which notifies us if a server is up or down. Recently we started writting an asp page that holds certain configuration data, one being the web url(which is used for check in). And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed, and if it has changed pull the new url and use that for the check in. I hope that made sense.
I look forward to hearing what you guys have to say.
And thanks in adavance to everyone that helps
Travis
|
|
|
|
|
tcombs07 wrote: And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed,
You shall use WebRequest[^] and WebResponse[^] classes. Using these, you can send request to the remote URI and get the status. So if you are getting a 404 message, you need to pull new URL and resend the request to there.
|
|
|
|
|
Hi all!
I have an issue regarding the property grid control. When property values are changed I create an undo/redo action using the "PropertyValueChanged" event handler. This works great when only one object is selected.
When multiple objects are selected the event is still only triggered once, and the 'PropertyValueChangedEventArgs' argument only provides the old value for one of the selected objects.
Does anybody know how I can access the old value for each of the selected objects within this event handler? Or perhaps there is an event along the lines of "BeforePropertyValueChanged".
Thanks!
Lea Hayes
|
|
|
|
|
Hi All,
I have a layer in my app that needs to get a handle on my main window. Its a WPF app so I can use something like:
WindowInteropHelper wih = new WindowInteropHelper(Application.Current.MainWindow);
The problem is that the layer that needs this handle is referenced by my presentation layer. How do I go about exposing this value from the presentation layer to the other assembly? I have looked at InternalsVisibleTo but that seems to be a bit all encompassing and more geared towards unit testing.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
ahhh ... seems I'm being daft ... I was missing
using System.Windows
schoolboy error ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi, as simple as it sounds i'm having difficulties to achieve this.
I have tried several ways but none of them works. This a part of my
code:
decimal amount = reader.GetSqlMoney(4).ToDecimal();
subtotal += amount ;
What happens is that the value returned every time from my
first line of code is zero.
Also when i tried for testing purposes to give that value
to a control's text property it works fine.
Thanks
|
|
|
|
|
I would do it like this:
decimal amount = (decimal)rdr["MoneyColumnName"]; Just cast to decimal and forget about money in the C# side of things. That's the way I have always done it and I have had no issues.
After all, in SQL Server money is actually a decimal with a specific precision.
|
|
|
|
|
i'm still getting zero as a result. do you think anything
else could be wrong that i should double-check?
|
|
|
|
|
Well, the obvious things. Is your query returning the value of a money column? If you execute your query in SQL Management Studio, do you get the correct value?
Could you show more code (creating the command, the parameters, the query or stored procedure, and so on)?
|
|
|
|
|
Do you close your Database Connection prior reading the DataReader?
Did you check the HasRows property for your DataReader?
Did you check while (reader.Read()) before casting the values?
example:
conn.Open();
SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
// your castings here
}
}
reader.Close();
conn.Close();
|
|
|
|