I created a method in Matlab for quantizing an Image. But I don't seem to get a good quantization of the image. (For example, when I quantize the image after using DWT and then use IDWT, the image is. MATLAB Program for Uniform Quantization Encoding MATLAB Program for Uniform Quantization Decoding MATLAB Program for Calculating Signal. Image compression Huffman encoding and decoding, matlab. Uniform quantization of wavelet image. Sampling, Quantization, and Pulse Code Modulation. Quantization (both uniform and nonuniform).
Descriptiony = uencode(u,n) quantizes the entries ina multidimensional array of floating-point numbers u andencodes them as integers using 2n-levelquantization. n mustbe an integer between 2 and 32 (inclusive). Inputs can be real orcomplex, double- or single-precision. The output y and the input u arearrays of the same size. The elements of the output y are unsignedintegers with magnitudes in the range [0, 2n-1].Elements of the input u outside of the range [-1,1] aretreated as overflows and are saturated.
y = uencode(u,n,v) allowsthe input u to have entries with floating-pointvalues in the range [-v,v] before saturating them(the default value for v is 1).Elements of the input u outside of the range [-v,v] aretreated as overflows and are saturated:
y = uencode(u,n,v, mapsentries in a multidimensional array of floating-point numbers u whoseentries have values in the range [-v,v ] to an integeroutput y . Input entries outside this range aresaturated. The integer type of the output depends on the number ofquantization levels 2n andthe value of 'SignFlag' , which can be oneof the following:
The output data types are optimized for the number of bits asshown in the table below.
Segment Image into Three Levels Using Two Thresholds
Read image and display it.
Calculate two threshold levels.
Segment the image into three levels using
imquantize .
Convert segmented image into color image using
label2rgb and display it.
Compare Thresholding Entire Image Versus Plane-by-Plane Thresholding
Read truecolor (RGB) image and display it.
Generate thresholds for seven levels from the entire RGB image.
Generate thresholds for each plane of the RGB image.
Process the entire image with the set of threshold values computed from entire image.
Process each RGB plane separately using the threshold vector computed from the given plane. Quantize each RGB plane using threshold vector generated for that plane.
Display both posterized images and note the visual differences in the two thresholding schemes.
To compare the results, calculate the number of unique RGB pixel vectors in each output image. Note that the plane-by-plane thresholding scheme yields about 23% more colors than the full RGB image scheme.
Reduce the number of discrete levels in an image from 256 to 8. This example uses two different methods for assigning values to each of the eight output levels.
Read image and display it.
Split the image into eight levels by obtaining seven thresholds from multithresh.
Construct the
valuesMax vector such that the maximum value in each quantization interval is assigned to the eight levels of the output image.
Similarly, construct the
valuesMin vector such that the minimum value in each quantization interval is assigned to the eight levels of the output image. Instead of calling imquantize again with the vector valuesMin , use the output argument index to assign those values to the output image.
Display both eight-level output images side by side.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |