跳转至内容
  • 版块
  • 最新
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
品牌标识

真紅の資源討論組

  1. 主页
  2. blog & 技术 & 教程
  3. favorite立绘合成工具

favorite立绘合成工具

已定时 已固定 已锁定 已移动 blog & 技术 & 教程
favorite
4 帖子 4 发布者 1.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • listderL 离线
    listderL 离线
    listder
    写于 最后由 编辑
    #1

    测试解包软件为:garbro 其他软件可能会出现兼容问题
    fav-bs.7z
    源代码:

    #include<bits/stdc++.h>
    #include <io.h>
    #include <windows.h>
    #include <direct.h> 
    #include <opencv2/opencv.hpp>
    
    #define image1 img1
    #define image2 img2
    #define mmax 100000
    
    using namespace cv;
    using namespace std;
    
    void getFileNames(string path, vector<string>& files);
    void imgset(string path1, string path2);
    void overlayImages(const cv::Mat& background, const cv::Mat& foreground, cv::Mat& output, int x, int y) {
    	output = background.clone();
    	cv::Rect roi(x, y, foreground.cols, foreground.rows);
    	roi &= cv::Rect(0, 0, background.cols, background.rows);
    	cv::Mat roi_output = output(roi);
    	cv::Mat roi_foreground = foreground(cv::Rect(0, 0, roi.width, roi.height));
    	for (int i = 0; i < roi.height; ++i) {
    		for (int j = 0; j < roi.width; ++j) {
    			cv::Vec4b pixel_foreground = roi_foreground.at<cv::Vec4b>(i, j);
    			cv::Vec4b& pixel_output = roi_output.at<cv::Vec4b>(i, j);
    
    			double alpha = pixel_foreground[3] / 255.0;
    			double beta = 1.0 - alpha;
    
    			for (int k = 0; k < 3; ++k) {
    				pixel_output[k] = static_cast<uchar>(alpha * pixel_foreground[k] + beta * pixel_output[k]);
    			}
    		}
    	}
    }
    
    int main(){
    	system("md output");
    	system("md input");
    	system("cls");
    	printf("1.将立绘底部扔在程序目录下重命名为base.png\n2.将立绘面部扔在程序下input文件夹\n3.然后立绘将生成在output文件夹\n注意事项:请确保文件夹下没有其他类型的文件,并且所有文件为png文件\n");
    	system("pause");
    	system("cls");
    	char cwd[256];
    	_getcwd(cwd, 256);
    	//cout << cwd << endl;
    	string pp = cwd, pp1[mmax],pp2=pp+"\\base.png";
    	int pn = 0;
    	vector<string> fileNames;
    	string path(pp+"\\input");
    	getFileNames(path, fileNames);
    	for (const auto &ph : fileNames) {
    		pp1[pn] = ph;
    		pn++;
    	}
    	for (int i = 0; i < pn; i++)
    		imgset(pp1[i], pp2);
    	system("cls");
    	printf("完成!\n");
    	system("pause");
    	return 0;
    } 
    
    void getFileNames(string path, vector<string>& files){
    	intptr_t hFile = 0;
    	struct _finddata_t fileinfo;
    	string p;
    	if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1){
    		do{
    			if ((fileinfo.attrib & _A_SUBDIR)){
    				if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
    					getFileNames(p.assign(path).append("\\").append(fileinfo.name), files);
    			}
    			else{
    				files.push_back(p.assign(path).append("\\").append(fileinfo.name));
    			}
    		} while (_findnext(hFile, &fileinfo) == 0);
    		_findclose(hFile);
    	}
    }
    
    void imgset(string path1, string path2){
    	ifstream pic;
    	pic.open(path1,ios::binary);
    	for(int i=0;i<43;i++) pic.get();
    	int x=pic.get()*16*16+pic.get();
    	for(int i=0;i<2;i++) pic.get();
    	int y=pic.get()*16*16+pic.get();
    	Mat img1 = cv::imread(path2, cv::IMREAD_UNCHANGED);
    	Mat img2 = cv::imread(path1, cv::IMREAD_UNCHANGED);
    	Mat mergedImg;
    	overlayImages(img1,img2,mergedImg,x,y);
    	int plen1 = path1.size(), plen2 = path2.size(), p1=0, p2=0;
    	for (; path1[plen1 - p1] != '\\'; p1++);
    	for (; path2[plen2 - p2] != '\\'; p2++);
    	//cout << p1 << ' ' << p2 << endl;
    	string sp1="", sp2="";
    	for (int i = 1; i < p1 - 4; i++) sp1 += path1[plen1 - p1 + i];
    	for (int i = 1; i < p2 - 4; i++) sp2 += path2[plen2 - p2 + i];
    	//cout << sp1 << ' ' << sp2;
    	imwrite(sp1 + '_' + sp2 + ".png", mergedImg);
    	string temp = "move " + sp1 + '_' + sp2 + ".png" + " output";
    	system(temp.c_str());
    }
    

    反正骰子已经掷出去了,而且能够决定骰子点数的并不是自己

    1 条回复 最后回复
    2
    • shinnkuS 离线
      shinnkuS 离线
      shinnku
      写于 最后由 编辑
      #2

      这个东东怎么用啊

      可愛くてごめん

      1 条回复 最后回复
      1
      • 阿 离线
        阿 离线
        阿拉灯神丁
        写于 最后由 编辑
        #3

        应该就是先用garbro拆包F社的Gal, 然后拆包提取出的立绘是分底图和面部表情的.
        这个程序是把底图和面部表情合并在一起恢复成完整的立绘.
        (这C++代码看着头疼😑又让我想起了敲代码的日子

        1 条回复 最后回复
        1
        • hachiroku8620H 离线
          hachiroku8620H 离线
          hachiroku8620
          写于 最后由 编辑
          #4

          要不。。。合并一下主题?

          1 条回复 最后回复
          2
          回复
          • 在新帖中回复
          登录后回复
          • 从旧到新
          • 从新到旧
          • 最多赞同


          • 登录

          • 没有帐号? 注册

          • 登录或注册以进行搜索。
          Powered by NodeBB Contributors
          • 第一个帖子
            最后一个帖子
          0
          • 版块
          • 最新
          • 标签
          • 热门
          • 用户
          • 群组