Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Tutorials & Challenges
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Tutorials & Challenges Feel free to publish your tutorials, challenges, & flight scenarios in this forum.

Reply
 
Thread Tools
Old 02-07-2008, 08:42 AM   #1
Enjo
Mostly harmless
 
Enjo's Avatar


Default 4 tutorial writers: Getting rid if blackenss from MFDs and space (some PNGs)

Hi

If you were ever making a tutorial and and were thinking about making a printable version of it, then you were surely pondering how much ink/toner the MFDs blackness printing would take. One solution would be to make a negative of the image, but then, you loose proper colors, which as you may guess, is very uneducational.

I've made a Matlab / Scilab script, which converts blackness into whiteness and vice versa, so the white writings are still visible. Here's a demo:



You can even allow for whitening of buttons, by making a screenshot in no panel view and while having transparent MFDs:



[EDIT] The visible stars problem has been solved. See my post below

The script works on Matlab with Image Processing toolbox installed, and in Scilab with Scilab Image Processing toolbox but the latter failed to run on my Windows machine. Linux should do it.
If you don't have Matlab, then you can send me your set of images along with a script containing the images' names such as the following example:

Code:
image=imread('aerobrakeMFD_01.png');
image_out = img_whitening(image);
figure
imshow(image_out);
imwrite(image_out, 'aerobrakeMFD_01_w.png');

image=imread('aerobrakeMFD_02.png'); 
image_out = img_whitening(image,1); % additionaly remove the stars
figure
imshow(image_out);
imwrite(image_out, 'aerobrakeMFD_02_w.png');

image=imread('aerobrakeMFD_09.png');
image_out = img_whitening(image,1); % additionaly remove the stars
figure
imshow(image_out);
imwrite(image_out, 'aerobrakeMFD_09_w.png');
Notice that the only thing that you need to change is the filename. All the rest is just Copy Paste.

Here's the img_whitening() function:

Code:
function [image_out] = img_whitening(image, star_elimination);
%
% Whitens blackness of MFDs' background and space from an image passed as 
% the first parameter. Pass a second integer parameter to remove stars from 
% the picture. The stars removing may do wonders to panels so use it only
% if neccessary

[x y z]=size(image);
image_out = image;
for i=1:x     % width
    for j=1:y    % heigth
        sum_black = 0;    
        sum_grey = 0;
        star = true;
        % a check to avoid index excession
        if i > 1 && j > 1 && i < x && j < y
            % check if all pixels adjacent to this one have different
            % colors. If yes, then we have hopefully identified a star
            k = 1;  % we only need one channel 
            if image(i-1,j,k)   == image(i,j,k) && star == true  star = false; end;
            if image(i-1,j-1,k) == image(i,j,k) && star == true  star = false; end;
            if image(i  ,j-1,k) == image(i,j,k) && star == true  star = false; end;
            if image(i+1,j-1,k) == image(i,j,k) && star == true  star = false; end;
            if image(i+1,j,k)   == image(i,j,k) && star == true  star = false; end;
            if image(i+1,j+1,k) == image(i,j,k) && star == true  star = false; end;
            if image(i  ,j+1,k) == image(i,j,k) && star == true  star = false; end;
            if image(i-1,j+1,k) == image(i,j,k) && star == true  star = false; end;
        end;       
        if nargin == 1  star = false;  end;
        for k=1:z    % RGB channel (3 of them)
            % if this pixel in this channel is black...
            if image(i,j,k) == 0    sum_black=sum_black+1; end;         
            if star == false 
                % if this pixel in this channel is very bright...
                if image(i,j,k) > 230   sum_grey=sum_grey+1; end;    
                % if it is a star, then we're making the pixel white
            else  image_out(i,j,k) = 255;    end;
        end;
        if sum_black==z      % if all channels of this pixel were black
            for k=1:z image_out(i,j,k) = 255;    end;     % make white
        end
        if sum_grey==z      % if all channels of this pixel were bright
            for k=1:z   image_out(i,j,k) = 0;    end;    % make black
        end
    end
end
It should be possible to create an external program, using ImageMagick 's C++ API, but this would take some more time.

Last edited by Enjo; 02-09-2008 at 09:19 AM.
Enjo is offline   Reply With Quote
Old 02-07-2008, 05:31 PM   #2
Cornflake
Orbinaut
 
Cornflake's Avatar
Default

Wow thanks, this should certainly come in handy.

Now we need to find a way to make skyboxes work in Orbiter, to make some interesting backdrops... I get tired of black space with boring white specs while cruising
Cornflake is offline   Reply With Quote
Old 02-08-2008, 06:10 PM   #3
Enjo
Mostly harmless
 
Enjo's Avatar


Default

I have updated the script to make it remove the stars, as an option.




The stars removal does wonders to panels, so it's optional. When you use panels, then you won't need to remove the stars.

Script is updated in the first post
Enjo is offline   Reply With Quote
Old 02-11-2008, 05:43 PM   #4
Enjo
Mostly harmless
 
Enjo's Avatar


Default

I made a printable version of my own docs for Launch MFD. Maybe somebody will read them now

http://www.elwico.pl/~ender-sz/orbiter-pdf/pliki/dev/launchmfd/LaunchMFD-doc.pdf

The colors there aren't that meaningful though.
Enjo is offline   Reply With Quote
Old 07-03-2008, 02:16 AM   #5
polaris149Tiberius
Tutorial Publisher
 
polaris149Tiberius's Avatar
Default I have been reading them

I have been reading them I love your MFD!!! I use it in almost every single launch I do. Keep on making your MFD docs and other MFDs PLEASE!!
Thanks for the work you have done.
polaris149Tiberius is offline   Reply With Quote
Old 07-03-2008, 05:27 AM   #6
tblaxland
Webmaster
 
tblaxland's Avatar


Default 4 tutorial writers

And here I was expecting a story about The 4 Tutorial Writers...

Nice script, though.
tblaxland is offline   Reply With Quote
Old 07-03-2008, 12:51 PM   #7
ar81
Orbinaut
Default

I find that turning black to white makes drawings less readable.
ar81 is offline   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Tutorials & Challenges


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 04:03 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.