Image compression in machinelearning dataset - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 51 mins ago.
Improve this question
Microsoft Modelbuilder's autogenerated code suggests to load training/inference data like this:
var imageBytes = File.ReadAllBytes(path);
When I create a 100x100 bit solid colored cube in MSpaint and save it as .png and use above function to load the file I get a byte[342], while I would expect 100x100x3 bytes if it were uncompressed(?).
Am I correct to assume that the compression is intact here?
If a model is trained with compressed data, does it need similary compressed data when making predictions?
Could a model's performance improve if trained on uncompressed data?

Related

picture analysis - human figure picture is straight [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I'm looking for a way to analyze an image ( the human figure ) and verify whether it is necessary to rotate the image or images straight.
i'm using c# env.
If you could detect the eyes then you could figure out if the image should be rotated using the eyes positions.
if (eye1.y - eye2.y) > (eye1.x - eye2.x) => the image should be rotated
Of course you would have to check and subtract the smaller value from the higher value when you calculate the position difference in order for this to work

How to read row one at a time in Datagrid Wpf c# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
How can i read each row in Datagrid one at a time.
For example my datagrid has 5 data on it. And each data corresponds to a method / function in my C# solution.
I want to read it as data 1 then perform the corresponding function under that data.
then read data 2 then perform the corresponding function under that data 2. and so on..
Can anyone give me some idea how?
I assume you are not following MVVM, Get the Items From Your DataGrid like this,
var tmplist = (ObservableCollection<YourDataGridObject>)DataGrid.ItemsSource;
foreach (YourDataGridObjectitm in tmplist)
{
///Access elements
}

save a JPEG in progressive format [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
A similar question has already been asked on this thread:
Save JPG in progressive format
However, the answer marked is basically saying that it can't be done. However, considering it is done using other software, it definitely is something which C# can do.
Is there any way this can be done?
Magick.NET can do it with a code like this
using (MagickImage image = new MagickImage("input.png"))
{
// Set the format and write to a stream so ImageMagick won't detect the file type.
image.Format = MagickFormat.Pjpeg;
using (FileStream fs = new FileStream("output.jpg", FileMode.Create))
{
image.Write(fs);
}
// Write to .jpg file
image.Write("PJEG:output.jpg");
// Or to a .pjpeg file
image.Write("output.pjpg");
}
You can find more details here.

Write File and Save it as a .htm [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I Write the text file Demo.txt with Html tags i have save it as html(every time when i write it again)
this is my code...
System.IO.File.WriteAllText(#"D:\Demo.txt", string.Empty);
StreamWriter file2 = new StreamWriter(#"D:\Demo.txt", true);
int j = 0;
file2.WriteLine("<html><table border='1'>");
file2.WriteLine("<tr bgcolor='#99CCFF' >");
file2.WriteLine("</html>");
how to save it as .htm alredy having extention .txt...how to refresh text file or save it with .htm
Conditionally copy the file before or after you write to it.
if(System.IO.File.Exists("d:\Demo.txt"))
System.IO.File.Copy("d:\Demo.txt", "d:\Demo.htm", true);
http://msdn.microsoft.com/en-us/library/system.io.file.copy.aspx

compare two images with low quality [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am working on an algorithm to extract diffrences between two images with diffrent qualities for example you have a photoshop file which is created by a designer and then you print it out with some devices and you have scaned it and saved it as a bmp file.
the main question is how we can compare these two images?
it is not possible two compare pixel by pixel, because in scaned version many objects have changed for example lines become thicker.
my idea is to find any shapes in two images then compare them based on location and other shape featurs but the main problem is that in low quality images it become too difficult to compare.because in low quality we have noise and after noise canceling some shapes will be lost. for example when i use open and close or morphology filters i lose some characters such as "i Q O 0" or other shapes.what is your opinion ?
you have image1 & image2 that have to compare .In both images find corners by hough transform then register two images by corners.you can use findhomogrphy() .Now the two images are the same size.In the finial you can use matchTemplate() for find difference between two images.
The suggestion of #Mostafa Sataki sounds good. An alternative would be to align the images as suggested, then use a similarity measure such as MSE or PSNR
Another possibility would be to try to match keypoints from the two images to see if they are the same image.

Categories

Resources