jpeg

How can I split this function into smaller functions without sacrificing its functionality?

感情迁移 提交于 2019-12-20 05:37:11
问题 I got the code for MJPEG decoding from here and I am trying to split the code for IDCT into smaller functions. The IDCT function in the original code is as follows: void IDCT(int32_t *input, uint8_t *output) { int32_t Y[64]; int32_t k, l; for (k = 0; k < 8; k++) { for (l = 0; l < 8; l++) Y(k, l) = SCALE(input[(k << 3) + l], S_BITS); idct_1d(&Y(k, 0)); } for (l = 0; l < 8; l++) { int32_t Yc[8]; for (k = 0; k < 8; k++) Yc[k] = Y(k, l); idct_1d(Yc); for (k = 0; k < 8; k++) { int32_t r = 128 +

Why doesn't ImageIO preserve JPEG data when repeatedly loading and saving?

百般思念 提交于 2019-12-20 04:54:15
问题 Originally I wanted to try whether it is possible to reconstruct redacted data from a JPEG image, given that it is a lossy image format and the pixel values spread into the neighbor pixels. To test whether saving and loading JPEG images is reliable, I wrote the following program that repeatedly saves and loads a JPEG image until it reaches an image that has been seen before. Here is the code: package de.roland_illig.jpg import java.awt.image.BufferedImage import java.io.ByteArrayInputStream

How to convert YUV420P image to JPEG using ffmpeg's libraries?

南笙酒味 提交于 2019-12-20 04:15:28
问题 I'm trying to convert a YUV420P image ( AV_PIX_FMT_YUV420P ) to a JPEG using ffmpeg's libavformat and libavcodec . This is my code so far: AVFormatContext* pFormatCtx; AVOutputFormat* fmt; AVStream* video_st; AVCodecContext* pCodecCtx; AVCodec* pCodec; uint8_t* picture_buf; AVFrame* picture; AVPacket pkt; int y_size; int got_picture=0; int size; int ret=0; FILE *in_file = NULL; //YUV source int in_w = 720, in_h = 576; //YUV's width and height const char* out_file = "encoded_pic.jpg"; //Output

Image size shrunk out of nowhere

允我心安 提交于 2019-12-20 03:22:21
问题 I simply copied my image and saved it to another temp folder in the current directory, nothing is modified, but the image size is somehow reduced... why? from PIL import Image import os image_path = "/Users/moomoochen/Desktop/XXXXX.jpg" img = Image.open(image_path) pathname, filename = os.path.split(image_path) new_pathname = (pathname + "/temp") if not os.path.exists(new_pathname): os.makedirs(new_pathname) img.save(os.path.join(new_pathname, filename)) The image size is reduced quite a bit,

Best format for lossless image compression in C#

偶尔善良 提交于 2019-12-20 03:14:45
问题 I need to save video frames individually and compress them losslessly. I'm looking for the best method and format in c# - by best I mean the best balance of simplicity of implementation, good compression and reasonable processing requirements. I know PNG is lossless, but its compression isn't great for photo style images. I understand that there is a lossless Jpeg format, but is this implemented in C#? Are there other options I am unaware of? 回答1: Here are some compression ratio's for

JPEG Lossless in DICOM

浪尽此生 提交于 2019-12-20 02:56:36
问题 In the DICOM spec one of the Transfer Syntaxes is 1.2.840.10008.1.2.4.70 defined as JPEG Lossless, Nonhierarchical, First- Order Prediction (Processes 14 [Selection Value 1]) . What does "JPEG Lossless, Nonhierarchical, First- Order Prediction (Processes 14 [Selection Value 1])" mean? Is this format the same as JPEG-LS? This page seems to indicate that there is some difference (JPEG-LS is listed in the bottom section). Is is possible to read or write this format in Python? Looking over the

Qt jpeg can't work on my friend's PC

故事扮演 提交于 2019-12-20 02:52:34
问题 I am finishing a Qt app, but I encounted a problem. Here is it: I use this code to load image into a QGraphicsScene: QFile file(fileName); if(file.open(QFile::ReadOnly)){ QByteArray data=file.readAll (); pixmapItem.loadFromData (data,"jpeg"); } It works on my computer, but when I give this app to my friend, he just can't show this image. I Googled and searched Stack Overflow about this issue, which sounds like I need jpeg plugins. So, I do this: I copy qjpeg4.dll from C:\QtSDK\QtCreator\bin

Replace the image in a JPG image file but keep the metadata?

…衆ロ難τιáo~ 提交于 2019-12-20 02:46:10
问题 Is it possible to replace the image portion of a JPG but keep the embedded metadata? Alternatively, is there a way to reliably copy all metadata from one JPG image to another? Background: I have an ASP.NET web application that stores JPG images. Users use the tinyMCE image editor to edit the image in the browser (resize, crop, etc), then the browser sends this modified image up to the server. I need to replace the original image file with the edited one while preserving the original metadata.

HTTP headers for jpg files after mod_rewrite

只愿长相守 提交于 2019-12-20 02:37:13
问题 I'm using Apache's mod_rewrite to route requests for JPG files to a directory outside my web root. It generally has been fine, but there are a few images that do not display. I then realized that when I use PHP's get_headers() function on my image URLs, they are all returning Content-Type: text/html; charset=UTF-8 instead of the proper image/jpeg header types. I have tried explicitly setting the Content-Type: image/jpeg header and still, none of my images return the correct headers - although

Qt does not load JPG , just PNG

人盡茶涼 提交于 2019-12-19 21:27:08
问题 I work with my colleagues on the same project on Windows 7 64 bit version, Visual Studio 2008. They load JPG and they work. Through QPixmap and Stylesheets. And works. But for me, i can only work with PNG, the rest don´t work at all. I also tried to change paths on the environment variables, but i only see one Qt path (the bin) on it. Nothing about plugins, i guess... as i read on the documentation: "By default, Qt can read the following formats: Format Description BMP Windows Bitmap GIF