【求助】大家好,有人知道如何直接提取图片中的CMY值吗

littlecutepotato 2017-08-08 06:47:32
大家好,我有一张tiff格式,各颜色分通道保存的图片。现在想读出图片中每个像素点上的CMY值(0~100%变化)。例如,要读出下图,ps中某个点的cmy值。以前我是直接手动看信息栏,然后抄CMY;但是现在要读的每一个像素点上的CMY值,太多了,不方便一个个抄。
那么,请问:
(1)我能用什么软件实现?matlab可以吗?
(2)如果可以直接读取,那么在其他软件里读取的CMY和我们在PS信息栏里看到的CMY是同一个值吗?
(3)如果不能直接读取,我看网上有cmy与RGB的转化公式,那么我们是不是可以先用matlab读取每个像素点的RGB,再用矩阵计算给算出CMY吗?但是,网上的没有一个统一的转化公式,该用哪个呢?

麻烦会的大神,指导一下。谢谢~
...全文
749 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2018-01-03
  • 打赏
  • 举报
回复
这个反射弧有点长。
littlecutepotato 2018-01-03
  • 打赏
  • 举报
回复
引用 3 楼 zhao4zhong1 的回复:
仅供参考:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

using namespace std;
using namespace Gdiplus;

int main() {
    GdiplusStartupInput gdiplusstartupinput;
    ULONG_PTR gdiplustoken;
    GdiplusStartup(&gdiplustoken, &gdiplusstartupinput, NULL);

    wstring infilename(L"1.jpg");
    string outfilename("color.txt");

    Bitmap* bmp = new Bitmap(infilename.c_str());
    UINT height = bmp->GetHeight();
    UINT width  = bmp->GetWidth();
    cout << "width " << width << ", height " << height << endl;

    Color color;
    ofstream fout(outfilename.c_str());

    for (UINT y = 0; y < height; y++)
    for (UINT x = 0; x < width ; x++) {
            bmp->GetPixel(x, y, &color);
            fout << x << "," << y << ";"
                 << (int)color.GetRed()   << ","
                 << (int)color.GetGreen() << ","
                 << (int)color.GetBlue()  << endl;
    }

    fout.close();

    delete bmp;
    GdiplusShutdown(gdiplustoken);
    return 0;
}
百度搜“RGB转CMY”
谢谢谢谢~
赵4老师 2017-08-18
  • 打赏
  • 举报
回复
仅供参考:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

using namespace std;
using namespace Gdiplus;

int main() {
    GdiplusStartupInput gdiplusstartupinput;
    ULONG_PTR gdiplustoken;
    GdiplusStartup(&gdiplustoken, &gdiplusstartupinput, NULL);

    wstring infilename(L"1.jpg");
    string outfilename("color.txt");

    Bitmap* bmp = new Bitmap(infilename.c_str());
    UINT height = bmp->GetHeight();
    UINT width  = bmp->GetWidth();
    cout << "width " << width << ", height " << height << endl;

    Color color;
    ofstream fout(outfilename.c_str());

    for (UINT y = 0; y < height; y++)
    for (UINT x = 0; x < width ; x++) {
            bmp->GetPixel(x, y, &color);
            fout << x << "," << y << ";"
                 << (int)color.GetRed()   << ","
                 << (int)color.GetGreen() << ","
                 << (int)color.GetBlue()  << endl;
    }

    fout.close();

    delete bmp;
    GdiplusShutdown(gdiplustoken);
    return 0;
}
百度搜“RGB转CMY”
hui211314ddhui 2017-08-17
  • 打赏
  • 举报
回复
C++用libtiff读文件内容,然后就有相关的操作,好久没用过了,可以查查。
赵4老师 2017-08-09
  • 打赏
  • 举报
回复
电脑内存或文件内容或传输内容只是一个一维二进制字节数组及其对应的二进制地址; 人脑才将电脑内存或文件内容或传输内容中的这个一维二进制字节数组及其对应的二进制地址的某些部分看成是整数、有符号数/无符号数、浮点数、复数、英文字母、阿拉伯数字、中文/韩文/法文……字符/字符串、汇编指令、函数、函数参数、堆、栈、数组、指针、数组指针、指针数组、数组的数组、指针的指针、二维数组、字符点阵、字符笔画的坐标、黑白二值图片、灰度图片、彩色图片、录音、视频、指纹信息、身份证信息…… 推荐使用WinHex软件查看硬盘或文件或内存中的原始字节内容。

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧