반응형

로드한 이미지에 컬러키를 설정하고 투명하게 처리해 보자.

 

player.bmp

파란 배경의 BMP 파일을 준비한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include "SDL.h"
 
#pragma comment(lib, "sdl2.lib")
#pragma comment(lib, "sdl2main.lib")
 
int main(int argc, char* argv[]) {
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window* window = SDL_CreateWindow("SDL Test", SDL_WINDOWPOS_UNDEFINED,
        SDL_WINDOWPOS_UNDEFINED, 640480, SDL_WINDOW_RESIZABLE);
    SDL_Renderer* renderer = SDL_CreateRenderer(window, -10);
 
    SDL_Surface* bmpSurface = SDL_LoadBMP("player.bmp");
    SDL_SetColorKey(bmpSurface, SDL_TRUE, SDL_MapRGB(bmpSurface->format, 000xFF));
    // Set the color key (transparent pixel) in a surface.
    // The color key defines a pixel value that will be treated as transparent in a blit.
    // For example, one can use this to specify that cyan pixels should be considered
    // transparent, and therefore not rendered.
    SDL_Rect destRect = { 00, bmpSurface->w, bmpSurface->h };
    SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, bmpSurface);
 
    SDL_Event event;
    bool quit = false;
 
    while (!quit) {
        while (SDL_PollEvent(&event)) {
            switch (event.type) {
            case SDL_QUIT:
                quit = true;
                break;
            case SDL_KEYDOWN:
                printf("Key pressed: %s\n", SDL_GetKeyName(event.key.keysym.sym));
                if (event.key.keysym.sym == SDLK_ESCAPE)
                    quit = true;
                break;
            default:
                break;
            }
        }
 
        SDL_RenderCopy(renderer, texture, NULL&destRect);
        SDL_RenderPresent(renderer);
    }
 
    SDL_FreeSurface(bmpSurface);
    SDL_DestroyTexture(texture);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();
 
    return 0;
}
 

 

파란색(0, 0, 255)을 컬러키로 설정하는 코드를 작성하고 빌드한다.

 

파란색이 투명하게 처리되어 표시된다.

 

컬러키 설정 부분을 주석처리하고 빌드해 보자.

 

//SDL_SetColorKey(bmpSurface, SDL_TRUE, SDL_MapRGB(bmpSurface->format, 0, 0, 0xFF));

 

파란색이 그대로 표시된다.

 

반응형
Posted by J-sean
:
반응형

Hue is the color portion of the model, expressed as a number from 0 to 360 degrees:

Red: falls between 0 and 60 degrees.

Yellow: falls between 61 and 120 degrees.

Green: falls between 121-180 degrees.

Cyan: falls between 181-240 degrees.

Blue: falls between 241-300 degrees.

Magenta: falls between 301-360 degrees.


For HSV, OpenCV Hue range is [0,179], Saturation range is [0,255] and Value range is [0,255]. Different software uses different scales. So if you are comparing OpenCV values with them, you need to normalize these ranges.


HSV(Hue)를 이용하면 RGB를 이용하는 것 보다 간단히 특정색을 검출할 수 있다. OpenCV의 Hue값은 0~179 이다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <opencv2/opencv.hpp>
 
using namespace std;
using namespace cv;
 
int lowerHue = 40, upperHue = 80;    // Green
Mat src, src_hsv, mask, dst;
 
void OnHueChenaged(int pos, void* userdata)
{
    Scalar lowerb(lowerHue, 1000);
    Scalar upperb(upperHue, 255255);
 
    inRange(src_hsv, lowerb, upperb, mask);
    // Checks if array elements lie between the elements of two other arrays.
 
    dst.setTo(0);    // 매번 초기화 해 주지 않으면 이전에 선택한 색과 겹친다.
    src.copyTo(dst, mask);
    // The method copies the matrix data to another matrix. Before copying the data, the method invokes: m.create(this->size(), this->type());
    // so that the destination matrix is reallocated if needed.While m.copyTo(m); works flawlessly, the function does not handle the case of a
    // partial overlap between the sourceand the destination matrices. When the operation mask is specified, if the Mat::create call shown above
    // reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.
 
    imshow("mask", mask);
    imshow("dst", dst);
}
 
int main(int argc, char** argv)
{
    src = imread("candies.jpg", IMREAD_COLOR);
    if (src.empty()) {
        cerr << "Image load failed." << endl;
        
        return -1;
    }
 
    imshow("src", src);
 
    cvtColor(src, src_hsv, COLOR_BGR2HSV);
 
    namedWindow("mask");
    createTrackbar("Lower Hue""mask"&lowerHue, 179, OnHueChenaged);
    createTrackbar("Upper Hue""mask"&upperHue, 179, OnHueChenaged);
    OnHueChenaged(NULLNULL);
 
    waitKey(0);
    
    return 0;
}




Original candy image.


Mask for green color.


Green candies detected.


반응형
Posted by J-sean
:
반응형

Color Picker will be very useful if you are working as a Web Developer or UI designer, who mainly uses Visual Studio for the day to day assignments. This tool provides a color tool window, color swatcher in the editor.


This tool offers the below options,

  • Highlight colors in Visual Studio Document Editor (".css", ".scss", ".less", ".asp", ".aspx", ".htm", ".html", ".cshtml", ".vbhtml", ".xaml" are enabled by default), Additional Parsing, Customize using Tools-Options-ColorPicker.
  • Edit color using double click from any enabled file (editor)
  • Insert colors to any active text document
  • Color Selection from Color Canvas.
  • Color Selection from Available Colors.
  • Color Selection from Standard Colors.
  • Color Selection from Saved Colors.
  • Color Selection using Eyedropper.
  • Copy\Paste Color codes (Name, #HEX, rgb, rgba, hsl, hsla, hsb\hsv, cmyk). rgb and rgba are offered in different formats
  • Selected colors Tints & Shades.
  • Color code comparison of Orginal and New.

Visual Studio에서 원하는 색상 코드를 확인 할 수 있는 Extenstion 입니다.

색깔의 이름으로 검색하거나 코드를 색깔로, 색깔을 코드로 변환할 수도 있고 찾은 색을 저장 하거나 소스 코드에 바로 삽입하는 등의 기능이 지원 됩니다.


Tools - Extensions and Updates...


Click 'Online' tab and search 'color picker'.


Close Visual Studio.


Click 'Modify' button on VSIX installer.


It starts installing.


Click 'Close' button.


Tools - Color Picker




Click 'Color Eyedropper'. Or you can enter any name of the colors into the edit box, e.g., red, blue, green, or etc.


Move the mouse cursor and click on the color you want.


Color Picker shows the color and its codes.


You can change the format by clicking on the code format.


Click the check button and insert the color code into your source.


Tools - Options...


Color Picker - General - You can change options.



반응형
Posted by J-sean
:
반응형

x64dbg를 설치하고 실행해 보면 아래와 같이 밝은 배경으로 표시 된다.

 

아래 링크에서 원하는 Color Scheme을 다운 받고 압축을 풀어 주자. (

mostlyblack.ini
다운로드

)

x64dbg Color Schemes

 

Options - Import settings... 를 선택 한다.

 

다운 받은 Color Scheme 파일을 선택해 준다.

 

선택한 Color Scheme이 바로 적용 된다.

 

 

파일을 열어 보면 아래와 같이 표시 된다.

 

 

 

반응형

'Reverse Engineering' 카테고리의 다른 글

Cheat Engine으로 Multilevel pointers 찾기  (0) 2019.03.20
x64dbg 패치한 파일 저장하기  (0) 2019.03.05
Cheat Engine으로 Pointer 찾기  (2) 2019.02.13
Back to user mode  (4) 2019.02.10
Windows 10에서 *.hlp 파일 열기  (10) 2019.02.05
Posted by J-sean
:
반응형

IDA Pro를 설치하고 파일을 disassembling 해 보면 밝은 스킨이 적용된 화면이 나타난다.

 

 

어두운 스킨 적용을 위해 아래 링크에서 파일을 다운 받는다. (

IDASkins-master.zip
다운로드

이 파일을 받아도 된다)

https://github.com/zyantific/IDASkins

 

다운 받아서 압축을 풀고 plugins 폴더를 확인해 보면 아래와 같은 폴더와 파일이 있다.

 

IDA Pro가 설치된 폴더 - plugins 폴더에 모두 복사한다. (idaskins.py는 그림에 표시되지 않았다)

 

IDA Pro를 실행시키고 Edit - Plugins - IDASkins: Settings를 선택한다. (Ctrl + Shift + S)

 

 

Theme selection 에서 IDASkins dark를 선택한다.

 

Options - Colors... 를 선택 한다.

 

Import 를 선택하고 plugins\idaskins\themes\idaskins-dark\ida-consonance.clr 을 선택한다.

 

원하는 파일을 disassembling 해 보면 아래와 같은 skin이 적용되어 표시 된다.

 

 

반응형

'Reverse Engineering' 카테고리의 다른 글

x64dbg Color Scheme 바꾸기  (0) 2019.02.19
Cheat Engine으로 Pointer 찾기  (2) 2019.02.13
Back to user mode  (4) 2019.02.10
Windows 10에서 *.hlp 파일 열기  (10) 2019.02.05
ollydbg Jump 위치 표시  (2) 2019.02.02
Posted by J-sean
: