How to extract quantization matrices from a JPEG in C# - c#

Is it possible to extract the quantization matrices of a JPG file in C#? I have found the libjpeg.NET but I cannot figure out how to retrieve the QTs matrices. Please find below my code.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitMiracle.LibJpeg;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
string file = #"PATH_TO_FILE";
JpegImage img = new JpegImage(file);
Console.Read();
// Ideally, there should be some img.GetQuantizationMatrix() method
}
}
}

If you just want the quantization tables (and nothing else), it is a simple matter to scan the JPEG stream for the DQT marker (FFDB-followed by a 2-byte length) and extract the values.
You do not need to decode the image to get this information.

Thanks to the suggestion by #user3344003, I managed to read the JPEG header to extract quantization matrix information. I followed the file layout spec presented in this web page.
void Main()
{
string folder = #"PATH_TO_FILE";
var files = Directory.GetFiles(folder, "*jpg", SearchOption.AllDirectories);
byte dqt = 0xDB;
foreach (string file in files)
{
file.Dump();
byte[] s = File.ReadAllBytes(file);
for (int i = 0; i < s.Length-1; i++) {
byte b1 = s[i];
byte b2 = s[i+1];
if (b1 == 0xff && b2 == 0xdb) {
int field_length = s[i + 2] + s[i + 3];
int matrix_length = field_length - 3;
int qt_info = s[i + 4];
("QT info" + qt_info).Dump();
("QT Matrix").Dump();
byte[] mat = new byte[matrix_length];
for (int k = 0; k < matrix_length; k++) {
mat[k] = s[i+5+k];
}
Print8x8Matrix(mat);
}
}
}
}
public static void Print8x8Matrix(byte[] bytes)
{
string s = "";
for (int i= 0; i < bytes.Length; i++) {
s += bytes[i] + " ";
if (i % 8 == 0)
{
s.Dump();
s="";
}
}
}

Related

C# Bitmap: System.ArgumentException "Invalid parameter."

Faced such a problem "System.ArgumentException", while writing an envelope from an image (.jpg) in a text file with a picture (ASCII). Did according to the instructions (https://www.bilibili.com/video/av5862027/)
For the second or third day I try to solve this problem.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO;
namespace ayy
{
class Program
{
static void Main(string[] args)
{
FileStream stream = new FileStream(#"meme.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter writer = new StreamWriter(stream);
for (int imageNumber = 0; imageNumber <= 7600; imageNumber++)
{
string url = #"C:\Users\Admin\source\repos\badapple\ayy\ba\ba";
if (imageNumber < 10)
{
url += "00000";
}
else if (imageNumber < 100)
{
url += "0000";
}
else if (imageNumber < 1000)
{
url += "000";
}
else
{
url += "00";
}
url += imageNumber.ToString() + ".jpg";
Bitmap image = new Bitmap(url, true);
for (int y = 0; y < image.Height; y++)
{
string str = "";
for (int x = 0; x < image.Width; x++)
{
Color pixel = image.GetPixel(x, y);
if (pixel.R > 200)
{
str += "#";
}
else
{
str += " ";
}
writer.WriteLine(str);
}
Console.WriteLine(url);
}
writer.Close();
}
}
}
}
using, using, using
Every time you go to play with something (or create an object) check if you can use a using statement
If you expect a file to be there, do some due diligence and check if it exists
If you want to join paths and file names, use Path.Combine()
GetPixel is extremely slow, so probably better to use LockBits
Why use lots of ifs to add 0's when you can use a format specifier $"{imageNumber:D5}.jpg"
Truthfully, i am not sure if this will fix your problem, but you are much better place regardless
using (var stream = new FileStream(#"meme.txt", FileMode.OpenOrCreate, FileAccess.Write))
{
using (var writer = new StreamWriter(stream))
{
for (var imageNumber = 0; imageNumber <= 7600; imageNumber++)
{
var dir = #"C:\Users\Admin\source\repos\badapple\ayy\ba\ba";
var fileName = Path.Combine(dir, $"{imageNumber:D5}.jpg");
if (File.Exists(fileName))
{
throw new FileNotFoundException($"Woah, what now : {fileName}");
}
using (var image = new Bitmap(fileName, true))
{
for (var y = 0; y < image.Height; y++)
{
for (var x = 0; x < image.Width; x++)
{
var pixel = image.GetPixel(x, y);
writer.Write(pixel.R > 200 ? "#" : " ");
}
writer.WriteLine();
}
}
}
}
}
If you are still having problems, work out what file is causing the problem, check to see if it is actually an image and loads. My spidey senses tells me its not

HeapSort Algorythm from txt file to list of arrays doesn't Sort the numbers

So I have to make HeapSort Algorythm for University using pseudocode I was given (only for heapsort). And I have to use input and output file. But for now I have only made input file which is working fine since it loads the txt file and writes down all the numbers in Console. So the problem is that after adding sorting methods to Main nothing changes. Also I decided to make a test for every method and all of them writes down my numbers once and that is it. I am not really good with sorting so it is hard for me to find the issue. Also because it is from pseudocode I had to use and no the code I could do for myself. So Do You know what cause thats issue that the sorting doesn't occure?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using System.IO;
using System.Windows.Forms;
namespace Zad4
{
class Program
{
void Heapify(List<int> array, int i, int n)
{
int largest, temp;
int parent = i;
int left = 2 * i + 1;
int right = 2 * i + 2;
if (left < n && array[left] > array[parent])
{
largest = left;
}
else
{
largest = parent;
}
if (right < n && array[right] > array[largest])
{
largest = right;
}
if (largest != i)
{
temp = array[i];
array[i] = array[largest];
array[largest] = temp;
Heapify(array, largest, n);
}
}
void BuildHeap(List<int> array, int n)
{
int i;
for (i = (n - 1) / 2; i >= 0; i--)
{
Heapify(array, i, n);
}
}
void HeapSort(List<int> array, int n)
{
int i, temp;
for (i = n - 1; i >= 0; i--)
{
temp = array[0];
array[0] = array[n - 1];
array[n - 1] = temp;
n = n - 1;
Heapify(array, 0, n);
Console.WriteLine(string.Join(" ", array));
}
}
static void Main(string[] args)
{
int n = 0;
Program A = new Program();
StreamReader myFile =
new StreamReader("C:\\Users\\dawid\\Desktop\\C#\\Heapsort\\dane.txt");
string myString = myFile.ReadToEnd();
myFile.Close();
char rc = (char)10;
String[] listLines = myString.Split(rc);
List<List<int>> listArrays = new List<List<int>>();
for (int i = 0; i < listLines.Length; i++)
{
List<int> array = new List<int>();
String[] listInts = listLines[i].Split(' ');
for (int j = 0; j < listInts.Length; j++)
{
if (listInts[j] != "\r")
{
array.Add(Convert.ToInt32(listInts[j]));
}
}
listArrays.Add(array);
A.BuildHeap(array, n);
A.HeapSort(array, n);
}
foreach (List<int> array in listArrays)
{
foreach (int i in array)
{
Console.WriteLine(string.Join(" ", array));
}
}
Console.WriteLine();
Console.ReadLine();
}
}
}
So the solution I found is just changing the way I read my txt file and the most important one was bad use of my methods. So that is how it looks now and it sorting well. Maybe I shouldn't ask a question since I got an answer on my own. But well. There You go:
static void Main(string[] args)
{
Program A = new Program();
string[] array = System.IO.File.ReadAllLines(#"C:\Users\dawid\Desktop\C#\Heapsort\dane.txt");
int[] arrayInt = Array.ConvertAll(array, int.Parse);
A.BuildHeap(arrayInt, arrayInt.Length);
A.HeapSort(arrayInt, arrayInt.Length);
Console.WriteLine(string.Join(" ", arrayInt));
Console.ReadLine();
}

Problems converting an array to a two dimensional array

I have a text file called Labyrint, that I read into a char array. After that I read the char array into a list without the \n (line break character). After I did that I convert the list to an array. Now I want this array to be a two dimensional array, but how do I do that. Here is an image of the labyrint that is 21x21 in size Labyrint. And below is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace ConsoleApplication25
{
class Program
{
static char[] FloridaArray;
static string DenverString;
static string[,] names = new string[21, 21];
static List<object> wrd = new List<object>();
static void Main(string[] args)
{
//Increase Console Buffer Height
Console.BufferHeight = Int16.MaxValue - 1;
DenverString = ConvertStringArrayToString();
FloridaArray = DenverString.ToArray();
Console.WriteLine(DenverString);
for (int i = 0; i < FloridaArray.Length; i++)
{
if (FloridaArray[i] != '\n')
{
wrd.Add(FloridaArray[i].ToString());
}
}
foreach (object o in wrd)
{
Console.WriteLine(o);
}
//Here I check what index 21 contain in the list called wrd
Console.WriteLine("Here I check if index 21 contain character B: " + wrd[21]);
Console.WriteLine(wrd.GetType());
// Here I convert the list called wrd to an array.
object[] myArray = wrd.ToArray();
// Here I check what character is in index 21 in the array called myArray.
Console.WriteLine(myArray[21]);
//Here I look up the data type of myArray
Console.WriteLine(myArray.GetType());
for (int j = 0; j < 21; j++)
{
for (int i = 0; i <= 21; i++)
{
// how do I put the value from my char array into the two dimensional array?
names[j, i] = myArray[i].ToString();
Console.WriteLine(j + " names " + i);
}
}
}
static string ConvertStringArrayToString()
{
// Concatenate all the elements into a StringBuilder.
StringBuilder builder = new StringBuilder();
foreach (var value in File.ReadAllLines("Labyrint.txt", Encoding.UTF8).Skip(1))
{
builder.Append(value);
builder.Append('\n');
}
return builder.ToString();
}
}
}
I think the important point here is that your index into the main array needs to be calculated. From your nested loop indexers, the value you need is:
j*21 + i
So that makes you loop look like this:
for (int j = 0; j < 21; j++)
{
for (int i = 0; i <= 21; i++)
{
names[j, i] = myArray[j*21 + i].ToString();
Console.WriteLine(j + " names " + i);
}
}
You may need to adjust your indexes though, I cannot tell exactly as you haven't provided any example input.

Error when trying decompress byte array ( C#)

I am trying to decompress byte array into a bitmap. but getting error.
This my coding....when execute it produce the error that "Index was outside the bounds of the array."
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
private static byte[] minbuffer;
static void Main(string[] args)
{
byte[] buffer = new byte[] { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x83,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1B,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7B,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF9,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0x87,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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te[] raw, int width, int height)
{
byte[] signdecompress = new byte[width * height];
for (int h = 0; h < height; h++)
{
for (int w = 0; w < (width / 8); w++)
{
byte num = raw[h * (width / 8) + w];
int ByteIndex = (h * width + w * 8);
string str = Convert.ToString(num);
for (byte s = 0; s < 8; s++)
{
if (str[s] == '1')
{
signdecompress[ByteIndex + s] = (byte)(255);
}
else
signdecompress[ByteIndex + s] = (byte)(0);
}
}
}
return signdecompress;
}
}
}
please help. i need the result to become
0xFF,0xD8,0xFF,0xE0,0x00,0x10,0x4A,0x46,0x49,0x46,0x00,0x01,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0xFF,0xDB,0x00,0x43,0x00,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02,0x02,0x02,0x03,0x02,0x02,0x03,0x03,0x06,0x04,0x03,0x03,0x03,0x03,0x07,0x05,0x05,0x04,0x06,0x08,0x07,0x09,0x08,0x08,0x07,0x08,0x08,0x09,0x0A,0x0D,0x0B,0x09,0x0A,0x0C,0x0A,0x08,0x08,0x0B,0x0F,0x0B,0x0C,0x0D,0x0E,0x0E,0x0F,0x0E,0x09,0x0B,0x10,0x11,0x10,0x0E,0x11,0x0D,0x0E,0x0E,0x0E,0xFF,0xC0,0x00,0x0B,0x08,0x00,0x2C,0x00,0xA8,0x01,0x01,0x11,0x00,0xFF,0xC4,0x00,0x1F,0x00,0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0xFF,0xC4,0x00,0xB5,0x10,0x00,0x02,0x01,0x03,0x03,0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7D,0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xA1,0x08,0x23,0x42,0xB1,0xC1,0x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xDF,0xB2,0xAF,0xEC,0xE3,0xF0,0x5F,0xFB,0x0E,0x6F,0x86,0x9F,0x06,0x3C,0x2B,0xE1,0xBD,0x5B,0x47,0xF3,0xBF,0xB3,0xB5,0xCF,0xEC,0xB5,0xB9,0xD5,0xE1,0xF3,0xB7,0xF9,0x9F,0xE9,0xF3,0x6F,0xB9,0x39,0x12,0xBA,0x73,0x21,0xF9,0x0E,0xCF,0xBB,0xC5,0x7B,0xFD,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x51,0x5F,0xFF,0xD9
I'm not entirely clear on what you are trying to do here, but the reason for the error is down to this line here:
for (byte s = 0; s < 8; s++)
It assumes that the string str is always eight characters long. This will prevent the error.
for (byte s = 0; s < str.Length; s++)
But it may not give you the output you are after..?
Your program breaks at the line:
if (str[s] == '1')
At this line, str == 255. The loop tries to iterate through 8 places in a string containing 3. Therefore, when it hit index 3, it becomes out of bounds (we always start at 0).
Your 3rd and most inner for loop should be:
for (byte s = 0; s < str.Length; s++;)
{
if (str[s] == '1')
signdecompress[ByteIndex + s] = (byte)255;
else
signdecompress[ByteIndex + s] = (byte)0;
}
Iterating based on the Length of the string or Count of something is always best practice, unless you know definitively that you will always only have a given number of indices.

Insertion sort algorithm c#

I am trying to implement the Insertion sort in one of my programs. What I have been trying to create is a sorting program (in both ascending or descending order) However I have tried with algorithms such as quicksort and merge-sort, I am really new to c# and coding. The problem I am facing here is the fact that my files includes both a string of code, as well as a double/integer (example: 75.350, 74.430, Thursday, Friday) and since this algorithm is designed for integers. Is there a way to convert it please?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
StreamReader sh1Open = new StreamReader("c:..\\Files\\SH1_Open.txt");
string Sh1OpenString = sh1Open.ReadToEnd();
int[] x = { Convert.ToInt32(Sh1OpenString) };
int j;
int temp;
for (int i = 1; i < x.Length; i++)
{
j = i - 1;
while (j >= 0 && x[j]>x[j+1])
{
temp = x[j];
x[j] = x[j + 1];
x[j + 1] = temp;
j = j - 1;
}
}
for (int i = 0; i < x.Length; i++)
{
Console.WriteLine(x[i]);
}
Console.ReadKey();
}
}
}
The best way is probably using generic method with IComparable constraint.
T[] InsertionSort(T[] x) where T : IComparable<T>
{
for (int i = 0; i < x.Length-1; i++)
{
int j = i+1;
while (j>0)
{
if (x[j-1].CompareTo(x[j]) > 1)
{
T temp = x[j-1];
x[j - 1] = x[j];
x[j] = temp;
}
j--;
}
}
return x;
}
or using algorithm from http://www.codecodex.com/wiki/Insertion_sort
static void InsertSort(IComparable[] array)
{
int i, j;
for (i = 1; i < array.Length; i++)
{
IComparable value = array[i];
j = i - 1;
while ((j >= 0) && (array[j].CompareTo(value) > 0))
{
array[j + 1] = array[j];
j=j-1;
}
array[j + 1] = value;
}
}
Also, there is probably a bug in this line:
int[] x = { Convert.ToInt32(Sh1OpenString) };
because you're trying to convert whole file to one integer.
Since in C# the comparison operators are defined for strings you could just replace all relevant int variables with string variables. The algorithm should run the same (albeit a bit slower)

Categories

Resources