Hi, I am trying to find an easy way to manipulate an image so that I can reduce its quality from 8 to 3 bits.
What would be the easiest way to achieve this? Greetings
If you want to scale it linearly, simply divide each pixel value by 255/7 (i.e. if the original image is stored in matrix I, let the low-resolution image be J = I / (255/7)).
UPDATED: Due to an error in my scaling constant.
Here is an example:
, uint8 MATLAB, 0 255. 3 ( , 0 7), , :
uint8
>> data = uint8([0 23 128 200 255]); % Create some data of type uint8 >> scaledData = data*(7/255) scaledData = 0 1 4 5 7 >> class(scaledData) ans = uint8
, 0 7, , , - uint8, MATLAB. 0.
, ( ), 8 (, PNG 4- ).
int8 - Matlab. 3 8 int8, .
int8
Toolbox , numerictype :
numerictype
T = numerictype(s,w)
Cit. Matlab:
T = numerictype (s, w) numerictype : , s w.
Source: https://habr.com/ru/post/1719264/More articles:Возврат элемента формы в стиле CSS обратно в стиль браузера по умолчанию - htmlSplitting H.264 with ActionScript - actionscript-3GlobalSettings ViewModel - settingsОбучение написанию многоразовых библиотек - pythonchange password without entering old password in web administration tool - asp.netWCF: where to place the configuration and how to allow relative paths without HTTPContext - wcfOne-time location after installation from the application - .netJava text formatting - javaXcode & Interface Builder is no longer in sync - asynchronousПочему я не могу изменить Thread.Name в .NET? - multithreadingAll Articles