transparent labels on mapserver using a mapfile - opacity

i'm trying to add a watermark layer in my mapfile with a DEFAULT layer:
LAYER
OPACITY 20
NAME "copyright"
METADATA
"wms_title" "copyright"
END
STATUS DEFAULT
TYPE ANNOTATION
TRANSFORM ll
FEATURE
POINTS
220 -220
END
TEXT "Sample Image"
END
CLASS
LABEL
FONT "ARIAL"
TYPE TRUETYPE
SIZE 30
BUFFER 1
COLOR 60 60 60
FORCE TRUE
ANGLE 40
END
END
UNITS PIXELS
END
but it seems that the OPACITY is not working, cause it doesn't change anything. Is it possible to set the OPACITY for labels? what am i doing wrong?
Thnx in advance

well.. no.. apparently you can't change the opacity of labels in map server. Or at least not in this version
Follow this link for further reference: Add OPACITY support for LABEL rendering

Related

The mask codes appear different for same label in different images in fastai lesson 3-camvid.ipynb example. Is this an issue?

I'm trying the fastai example, lesson 3-camvid.ipynb, and there is a verification in the beginning of the example, about the images and labels. Where we can see the original image and a mask (ground thruth semantic segmentation) from that original image.
Example, image 150 from the camvid dataset:
img_f = fnames[150]
img = open_image(img_f)
img.show(figsize=(5,5))
get_y_fn = lambda x: path_lbl/f'{x.stem}_P{x.suffix}'
mask = open_mask(get_y_fn(img_f))
mask.show(figsize=(5,5), alpha=1)
But, if I change the image, for example to image 250 from the camvid dataset:
The mask label changes, eg. the road label has a different color from the previous image:
Apparently, it matters the order in which each label occurs on each image.
So, is this an issue? Is it something I should fix somehow?
Thanks in advance!
According to the official CamVid labels Road has to be the color as in the image 250.
Camvid Class Labels
You can leave the data set as it is, but if you looking for increasing model accuracy you can change the labels of the corresponding pixels. The Model is capable of identifying the road by other examples in data set.

Hide UI/Image partially in Unity 5

Does Unity 5 support partial hiding of a UI/Image?
For example, the UI/Image I have in my scene has 100 width and 100 height.
At time = 0, the UI/Image is hidden. When time = 5, the UI/Image only shows the first 50 pixels. When time = 10, the UI/Image is fully drawn.
The answer to the question is in this link
Set the image type to Filled
Set the fill method to horizontal
Set the fill origin to left
From the script, update the fill amount from 0 to 1 over the timespan
On first thought, I can come up with two workarounds for this.
If the background of the image-in-question is a solid color, you can use another image with the same color as background that covers the actual image, so that it looks like the actual image is partially revealed. Then, just reduce the length of this covering image over time to achieve a revealing effect using Coroutines.
You make multiple image files with alpha channels and change the textures of the UI/Image over time. Each image will act like an iteration of revealing effect. Say you have 11 images, the 6th image will have first half revealed, and second half as alpha=0. In this case, if you want smoothness, you will need a higher number of images.

iWatch: WKInterfaceLabel is it possible to stop text from being cut off with "..." at the end of a label?

The text in my WKInterfaceLabel is way too long and causes the text to be cut off with dots at the end. I know for UILabel for iOS you can easily resolve this issue by enabling clip mode. I don't believe there is any way for me to resolve this for watchkit. This is going to force me to use an Image if I can't prevent the text from being cut off. Any tips or suggestions is appreciated.
You have a couple options depending on how you want the view to respond. In your interface story board select your label and open the attributes inspector.
Your first option is to change the font to a smaller size. This is more for a static label that you want to style and leave set.
Your second option is to adjust the min scale value, changing this will automatically shrink the text to fit the window up to the value provided. For example if your font size is 12pt and you set the scale to .5, the font will shrink up to 6pt before appending the ellipsis (...).
Your third option is to set the number of lines to 0 (or a higher number). This will move the text down onto the next line.
Set the number of lines to 0 and ensure the label and any containing groups are set to fit content.
if you want your font size adjust according to label size follow this method
in WKInterfaceTable attribute inspector set min scale to 0
like in screen shoot
Result before Min scale = 0
Result after Min scale = 0
Note: your no of lines also set to 1

Changes Brightness in color replacement

I am working on replacing certain color in image by User's selected color. I am using OpenCV for color replacement.
Here in short I have described from where I took help and what I got.
How to change a particular color in an image?
I have followed the step or taken basic idea from answer of above link. In correct answer of that link that guy told you only need to change hue for colour replacement.
after that I run into the issue similar like
color replacement in image for iphone application (i.e. It's good code for color replacement for those who are completely beginners)
from that issue I got the idea that I also need to change "Saturation" also.
Now I am running into issues like
"When my source image is too light(i.e. with high brightness) and I am replacing colour with some dark colour then colours looks light in replaced image instead of dark due to that it seems like Replaced colour does not match with colour using that we done replacement"
This happens because I am not considering the brightness in replacement. Here I am stuck what is the formula or idea to change brightness?
Suppose I am replacing the brightness of image with brightness of destination colour then It would look like flat replacemnt and image will lose it's actual shadow or edges.
Edit:
When I am considering the brightness of source(i.e. the pixel to be processed) in replacment then I am facing one issue. let me explain as per scenario of my application.
for example I am changing the colour of car(like whiteAngl explain) after that I am erasing few portion of the newly coloured car. Again I am doing recolour on erased portion but now what happended is colour done after erase and colour before erase doesn't match because both time I am getting different lightness because both time my pixel of to be processed is changed and due to that lightness of colour changed in output. How to overcome this issue
Any help will be appreciated
Without seeing the code you have tried, it's not easy to guess what you have done wrong. To show you with a concrete example how this is done let's change the ugly blue color of this car:
This short python script shows how we can change the color using the HSV color space:
import cv2
orig = cv2.imread("original.jpg")
hsv = cv2.cvtColor(orig, cv2.COLOR_BGR2HSV)
hsv[:,:,0] += 100
bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite('changed.jpg', bgr)
and you get:
On wikipedia you see the hue is between 0 to 360 degrees but for the values in OpenCV see the documentation. You see I added 100 to hue of every pixel in the image. I guess you want to change the color of a portion of your image, but probably you get the idea from the above script.
Here is how to get the requested dark red car. First we get the red one:
The dark red one that I tried to keep the metallic feeling in it:
As I said, the equation you use to shift the light of the color depends on the material you want to have for the object. Here I came up with a quick and dirty equation to keep the metallic material of the car. This script produces the above dark red car image from the first light blue car image:
import cv2
orig = cv2.imread("original.jpg")
hls = cv2.cvtColor(orig, cv2.COLOR_BGR2HLS)
hls[:,:,0] += 80 # change color from blue to red, hue
for i in range(1,50): # 50 times reduce lightness
# select indices where lightness is greater than 0 (black) and less than very bright
# 220-i*2 is there to reduce lightness of bright pixel fewer number of times (than 50 times),
# so in the first iteration we don't reduce lightness of pixels which have lightness >= 200, in the second iteration we don't touch pixels with lightness >= 198 and so on
ind = (hls[:,:,1] > 0) & (hls[:,:,1] < (220-i*2))
# from the lightness of the selected pixels we subtract 1, using trick true=1 false=0
# so the selected pixels get darker
hls[:,:,1] -= ind
bgr = cv2.cvtColor(hls, cv2.COLOR_HLS2BGR)
cv2.imwrite('changed.jpg', bgr)
You are right : changing only the hue will not change the brightness at all (or very weakly due to some perceptual effects), and what you want is to change the brightness as well. And as you mentioned, setting the brightness to the target brightness will loose all pixel values (you will only see changes in saturation). So what's next ?
What you can do is to change the pixel's hue plus try to match the average lightness. To do that, just compute the average brightness B of all your pixels to be processed, and then multiply all your brightness values by Bt/B where Bt is the brightness of your target color.
Doing that will both match the hue (due to the first step) and the brightness due to the second step, while preserving the edges (because you only modified the average brightness).
This is a special case of histogram matching, where here, your target histogram has a single value (the target color) so only the mean can be matched in a reasonable way.
And if you're looking for a "credible source" as stated in your bounty request, I am a postdoc at Harvard and will be presenting a paper on color histogram matching at Siggraph this year ;) .

I have one pixel length color image and i wanted to scale up it according to new length value.

So color image length will change dynamically. I will use it on the custom graph. What is the best solution for this? now i am using Resize category by extending UIImage.
Thanks advance..
For this task you could use instance method of UIImage stretchableImageWithLeftCapWidth:topCapHeight:. Suppose
[imgObj stretchableImageWithLeftCapWidth:4.0f topCapHeight:5.0f];
This method call will live 4 pix from left & right and 5 pix from top & bottom of your image and will repeat the rest image in middle.
But in your case both values will be Zero.