text:
# Cell segmentation119

Posted by Steve Eddins,

Blog reader Ramiro Massol asked for advice on segmenting his cell images, so I gave it a try. I'm not a microscopy expert, though, and I invite readers who have better suggestions than mine to add your comments below.

Let's take a look first to see what we have. I'm going to work with a cropped version of the original so that the images aren't too big for the layout of this blog.

Note: you can download the functions imcredit and imoverlay from MATLAB Central.

I = imread('http://blogs.mathworks.com/images/steve/60/nuclei.png');
I_cropped = I(400:900, 465:965);
imshow(I_cropped)
imcredit('Image courtesy of Dr. Ramiro Massol')

Strictly speaking, contrast adjustment isn't usually necessary for segmentation, but it can help the algorithm developer see and understand the image data better. This is a fairly low-contrast image, so I thought it might help. You can adjust the display contrast interactively with imtool, or you can use an automatic method such as adapthisteq. adapthisteq implements a technique called contrast-limited adaptive histogram equalization, or CLAHE. (I always thought "CLAHE" sounded like it must be some Klingon delicacy.)

I_eq = adapthisteq(I_cropped);
imshow(I_eq)

So what happens if we just apply a threshold now?

bw = im2bw(I_eq, graythresh(I_eq));
imshow(bw)

Let's clean that up and then overlay the perimeter on the original image.

bw2 = imfill(bw,'holes');
bw3 = imopen(bw2, ones(5,5));
bw4 = bwareaopen(bw3, 40);
bw4_perim = bwperim(bw4);
overlay1 = imoverlay(I_eq, bw4_perim, [.3 1 .3]);
imshow(overlay1)

Now, I'm not familiar with these cell images, so I don't know exactly what I'm looking at. I assume some of these blobs need more help to be separated properly. One possible approach is called marker-based watershed segmentation. There's a demo of this idea on The MathWorks web site.

With this method, you have to find a way to "mark" at least a partial group of connected pixels inside each object to be segmented. You also have to mark the background.

Let's try to use the bright objects, which I assume are nuclei. The extended maxima operator can be used to identify groups of pixels that are significantly higher than their immediate surrounding.

mask_em = imextendedmax(I_eq, 30);
imshow(mask_em)

Let's clean that up and then overlay it.

mask_em = imclose(mask_em, ones(5,5));
overlay2 = imoverlay(I_eq, bw4_perim | mask_em, [.3 1 .3]);
imshow(overlay2)

Next step: complement the image so that the peaks become valleys. We do this because we are about to apply the watershed transform, which identifies low points, not high points.

I_eq_c = imcomplement(I_eq);

Next: modify the image so that the background pixels and the extended maxima pixels are forced to be the only local minima in the image.

I_mod = imimposemin(I_eq_c, ~bw4 | mask_em);

Now compute the watershed transform.

L = watershed(I_mod);
imshow(label2rgb(L))

I don't know if this is a good segmentation result or not, but I hope some of the methods I've shown will give Dr. Massol some ideas to try.

Get the MATLAB code

Published with MATLAB® 7.2

kruthika replied on : 1 of 119

hy…im sorry ….amnt here to give a comment…i am working on splittin and merging algorithms..i find there is some error with the splitmerge.m function given in ‘Digital Image Processing using MATLAB’…Could u please help me…i ve just learnt the basics of image segmentation….

thnk u…

Steve replied on : 2 of 119

Kruthika, Rafael Gonzalez knows more about the splitmerge function than I do. You can find contact information for Professor Gonzalez at http://www.imageprocessingplace.com.

ishraq replied on : 3 of 119

hi everbody,,
i have a qustion about coins segmentation ,,
i didn’t find a good way to segment the coins when they are
connected (the edges of coins are connected).

any one can help me please???!?!?!

ishraq replied on : 6 of 119

Dear Mr Steve ,
Thanks alot for your fast replaying ,
but I still have difficulties in using watershed because
im beginner in using MATLAB,

I like to add 2 new urls for coin images with overlapping between the edges

my problem is about how i can segment these coins in a good way so i can use “bwlabel” and “regionprops”
to recognize the coin types .

i hope from you to help me to find a way to segment these coins because you are expert person .

thanks you alot
ishraq

Steve replied on : 7 of 119

Ishraq – I’m sorry, but I can’t work this problem out for you, or help you learn MATLAB. Go through the Getting Started in MATLAB guide to get some MATLAB knowledge. Then look at the Image Processing Toolbox Users Guide and the product demos on our web site, including the one I already linked to. Look at the material in the documentation and demos on thresholding, morphological operators such as erosion and opening, and watershed segmentation.

Wilson replied on : 8 of 119

Hi there,
I have a query on how to use Matlab for Vehicle Plate segmentation?
I read from the papers that one solution is to gray scale the picture. But how does the system be so clever to segment out the unwanted parts and leave the vehicle plate untouched?
Hope to hear from you guys soon.
Cheers..

subrajeet mohapatra replied on : 9 of 119

Hi,
I have read your book but there is nothing about adaptive histogram equalization.Can u give me some ideas or the algorithm for adaptive histogram equalization.So that i can go to CLAHE.

Steve replied on : 10 of 119

Subrajeet – There is an implementation of CLAHE in the Image Processing Toolbox. See the adapthisteq function.

subrajeet mohapatra replied on : 11 of 119

can i get the complete algorithm

Steve replied on : 12 of 119

Subrajeet – The complete algorithm is summarized at the top of the M-file, plus you can always look at the code. The M-file also contains this reference: Karel Zuiderveld, “Contrast Limited Adaptive Histogram Equalization”, Graphics Gems IV, p. 474-485, code: p. 479-484

subrajeet mohapatra replied on : 13 of 119

Hi,
is there any built in function to measure signal to noise ratio for images ,My friend is telling there is Peak signal to noise ratio (PSNR) im image processing toolbox

Steve replied on : 14 of 119

Subrajeet – There’s no PSNR function in the Image Processing Toolbox, but it’s very easy to implement it directly from the formula.

Fabiano Malhard replied on : 15 of 119

Hi steve,

I am really new at MatLab and I am trying to work with images, reducing its size and later resizing them using one of the commons methods … but i would like to compare the resulting images with the original ones …

Can you help with the SNR function, or there is any other better aproach ???

Thanks

Steve replied on : 16 of 119

Fabiano – There are several different definitions of SNR used for image comparisons, so the details vary depending on the definition you are interested in. But the heart of the computation, typically something like a mean-squared error, is straightforward in MATLAB. If you are comparing A and B, it might look something like this:

mse = mean( (A(:) - B(:)).^2 );

rosani replied on : 17 of 119

Steve,
how to compute a confusion matrix to measure accuracy between two image(rgb,in pixel) from different source.

Steve replied on : 18 of 119

Rosani—I’m confused; what’s a confusion matrix?

bob gold replied on : 19 of 119

Hi my name is Bob Gold a pharmacist in Indiana. I
am interested in developing a method to determine the
number of tablets in a bottle for the purpose of
improving compliance. I am not an expert on cameras .

Do you have any ideas.
Thanks

Rob replied on : 20 of 119

Bob Gold,

I think first of all you’ll need some really wide, flat bottles so the pills are no more than 1 deep in the image. (sorry for the sarcasm, couldn’t resist)

Other than that, you could take a picture of pills in a regular bottle and compute an *estimate* of how many pills are packed in there. Depending on the pill shape, there are many standard packing computations, such as hexagonal-close-packed, body-centered-cubic, etc. Think lattice structures, but all the ones I’ve studied are for spheres. The main failing here is that you won’t get the real number, which it sounds like you need for compliance.

Hope this helps,
Rob

Steve replied on : 21 of 119

Bob—I don’t anything to concrete to suggest beyond what Rob said. It sounds like it might not be feasible except under very particular circumstances.

Rob—Thanks for jumping in.

Steve replied on : 22 of 119

Bob—OK, I do have one thought. I’d be more tempted to use a precision scale instead of a camera and image processing to measure the number of pills. But this kind of quality assurance application is a bit beyond my expertise.

Adnan Butt replied on : 23 of 119

Hello Sir,
I am working in MATLAB image processing and one thing I do have explored that most of the commands extracting quantitaive measures work only on 2D matrices there is not much material on 3D image processing in MATLAB?
Can you guide me in 3d Image processing in MATLAB?
Regards

Steve replied on : 24 of 119

Adnan—There are many functions in MATLAB and the Image Processing Toolbox that work on three-dimensional arrays, including filtering, transforms, morphology, and region measurements. Can you be more specific about what you are looking for?

Ben Taylor replied on : 25 of 119

Improvement: Blobs/particles touching the sides of the images will mess up your size measurements and shape characterization because they are not showing the whole particle. To remove all particles or cells touching the sides I wrote the following simple script that removes any particle touching the border of the image.

%%%%////
function L=borderstrip(L)
display(‘starting border strip’)
border=[L(end,:) L(1,:) L(:,end)’ L(:,1)’]; %these are all the pixels for the borders
background=mode(mode(L)); %this finds the most common pixel for the background which is usually 2

count=0;
for i=1:length(border)
if border(1,i)==2
border(1,i)=0;
else
count=count+1;
blacklist(count)=border(1,i);
end
end
blacklist=unique(blacklist); % this strips out all of the copied black listed pixels to be removed
height=size(L,1);width=size(L,2);
for j=1:length(blacklist)
for h=1:height
for w=1:width
if L(h,w)==blacklist(j)
L(h,w)=background;
end
end
end
end
display(‘ending border strip’)

Steve replied on : 26 of 119

Ben—You can use imclearborder to remove objects touching the border.

Saad Khan replied on : 27 of 119

Hi Steve,
Do you know of any matlab implementation of 3D deblurring (deconvolution)? The matlab image processing toolbox contains four deblurring functions but all of these work with images (2D data).
Thanks!

Steve replied on : 28 of 119

Saad—You can use the deconvolution routines in the Image Processing Toolbox. They are not limited to two dimensions.

VEN replied on : 29 of 119

Respected Sir,
I am Working in Matlab with Some Videos to Identify Moving
Object in that Video. I am Working in Matlab7 in which Video
Processing is not There. Now I am able to Identify the
moving objects Partially. Could you please Suggest me to Segment only that Moving objects In that Video. And also I want to Count the Number of segmented Object. Please help me in this matter.

Thanking You,

maged replied on : 30 of 119

i want functions that make segmantation of nodules in image by matlab
thanks

Shalin replied on : 31 of 119

3D deconvolution:

Hi Steve! Great page… Continuing on Saad’s query, could you help me with pointers on how to represent 3D point spread functions(in my case for optical microscope) and how to employ blind deconvolution.

Thanks
Shalin

Steve replied on : 32 of 119

Shalin—A 3D point spread function is represented as a 3D array containing the impulse response of the blur operator. There is an Image Processing Toolbox function for performing blind deconvolution. Did you have a specific question about it?

Stalin Mohapatra replied on : 33 of 119

Can you plz give me a complete MATLAB code on MEAN Filtering of Noisy Images?
It would be kind enough if you send it to my mail. I’ll be ever grateful to u.

Steve replied on : 34 of 119

Stalin—It sounds like you might just want to use imfilter (or the MATLAB function conv2) with a constant filter, such as ones(5,5)/25.

Adnan replied on : 35 of 119

Hi Steve, I posted the same query a couple of days ago but I cant see my Post now. Any way, There is a camera on road fixed in one position. I want to count the vehicles passed by the camera. But the problem is the segmentation i.e. to ignore any thing except vehicle. Kindly suggest me some proper algorithm for this problem.
Thanking in Anticipation
Regards

Eric replied on : 36 of 119

Hi Steve, I am trying to create circular and elliptical images as quality assurance tests for my image segmentation code. I can do a simple generate xy coordinates from parametric equations command, but I get a real blotchy image. I’ve figured out that it is because I’m not implementing Bresenham style line algorithums. Does matlab have built in Bresenham line drawing algorithums that can be augmented eaisly to draw nice smooth circles and ellipses in pixelated images?

Steve replied on : 37 of 119

Eric—As far as I understand, Bresenham drawing algorithms are for drawing shapes blazingly fast, with an absolute minimum of arithmetic, in low-level code. I’m not sure such a thing is really needed in MATLAB, where we get to do all the math we want. For example, the file toolbox/images/images/private/intline.m draws the same line between two pixels that a Bresenham line-drawing routine but, it uses some simple math to do it. So … what do you mean by “blotchy”?

I would probably “draw” a circle on an image using meshgrid and some sort of distance logic, like this:

[x,y] = meshgrid(linspace(-1,1,200));
bw = hypot(x,y) < = 0.25;

Wander replied on : 38 of 119

Dear Sir,
I want to find out the circularity and cell count of cell images after employing Marker Controlled Watershed transform. (Images are similar to those taken as illustration in this web-page). Can you kindly explain to me how to go ahead in this direction.

Steve replied on : 39 of 119

Wander—Use bwlabel and regionprops.

walid jerbi replied on : 40 of 119

Hi Steve,
I need to merge two regions in a labeled image. I want to know if there is a function that allow mes to do this?
Regards

Steve replied on : 41 of 119

Walid—Can you provide a more specific, detailed description of the operation you want to perform?

sherly replied on : 42 of 119

I am working with counting of cells in an image. I have segmented the cells but i need your help to count the number of cells

deepak replied on : 43 of 119

count the no: of pixels in the each segmented part

Steve replied on : 44 of 119

Sherly—If you have already segmented the cells, then use bwlabel to count them.

arindam replied on : 45 of 119

i am working on segmentation of myocardium and (general countour tracking) of heart from cardiac images . most articles seem to refer to using HMRF(hidden markov fields) and Expectation Maximisation namely

http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=906424

the images i am working on are available from
specifically akld-mrirg-cines-truefisp-long.zip
the first set 0f 32 images.(long 1)
any guidance in the right direction will be appreciated.

Administrator replied on : 46 of 119

Arindam—I am not familiar with cardiac image segmentation.

Asanka replied on : 47 of 119

Is there any way to eliminate closely spaced markers of the wathershed segmentation inorder to avoid over segmentation?

Any suggestions to avoid over segmentation?

Steve replied on : 48 of 119

Asanka—If you are generating your markers using the minima of something like a gradient image, you might try using something like imextendedmin in order to filter out shallow minima.

TMan replied on : 49 of 119

I’m trying to calculate the number distinct objects in a huge (about 6000×6000) binary image B.

[ignore count] = bwlabel(B);

won’t work because of the double precision ‘ignore’-image not fitting my memory.

count = sum(sum(bwmorph(B,’shrink’,Inf)))

is, on the other hand, way too slow.

Anyone having efficient solutions to this problem?

silvia replied on : 50 of 119

hi steve,

I want to measure the area of cell nucleus. Could you explain to me the steps to do that?

Steve replied on : 51 of 119

TMan—You can start with bwlabel and modify it to suit your needs. Look in the file for the line:

numComponents = length(sizes);

That’s the answer you are looking for, and that line occurs before the memory-consuming output label matrix is constructed.

Steve replied on : 52 of 119

Silvia—Once you have the nuclei segmented, you can use bwlabel and regionprops to measure the area. I can’t help you much with the segmentation problem. Image segmentation usually requires some custom algorithm development that depends on the specific characteristics of your data set. Consult texts on microscopy and image processing for some general methods that you might be able to adapt to your data.

JP replied on : 53 of 119

When I copy this image, save it as a PNG, and try to use it, I get an error. Here is my code:

——————–
%test work with imfill
I_cropped = I;
imshow(I_eq)
——————–

All I’m doing is reading in the image, which I copied from the webpage. THen I get this error:

——————-
Error in ==> imfill_test at 4

??? Function ADAPTHISTEQ expected its first input, I, to be two-dimensional.
—————–

I can use adaphisteq if I read in a GIF or TIF with [X,map]=imread… and then use ind2gray, but the example image on this blog will not work for me at all, evne when saved as a TIF, using the same code that reads another TIF. I’m using R2006b. There must be something I’m missing about the definition of the image or something.

JP replied on : 54 of 119

Ok, if anybody else had the same problem as me, just make sure you grab only the top 2-D layer of the PNG after you read it in. On my computer it came in as MxNx3 and made adapthisteq choke. When I said I_cropped=I(:,:,1); it picked up a 2-D matrix and was happy with that input.

Steve replied on : 55 of 119

JP—The second paragraph of this post has a link to the original nuclei.png image for use with this image. The images you see on this web page are automatically captured screen shots from MATLAB, and they are stored in a color format even if the originals are grayscale.

I have modified the first line of code (the call to imread) to show how to read the correct original image directly, using its URL. I hope this will help others avoid similar confusion.

JP replied on : 56 of 119

Thanks, Steve! Pesky color images that aren’t color…

I will keep working to adapt the method to my images. In a nutshell, I have two images of a fuel spray taken with different filters. Each image is zeroed by a dark image, so it is nearly zero outside of the spray itself. The images are stored as matrices and then divided pixel by pixel. Within the spray itself, the resulting data is fine. But outside of the spray, you wind up dividing small noise by small noise and you get pure trash outside of the spray. I’m trying to use the same techniques to outline my spray and make a mask so I can discard everything outside the spray. I’m getting there, but I keep getting tripped up in the difference between matrices, greyscale images and color images. I’ll get it soon. Thanks!

Administrator replied on : 57 of 119

JP—Sounds like an interesting application.

Rudi replied on : 58 of 119

Steve:

Can I use this concept to segment human heads in a crowd scene? But the occlusion problem could be a significant issue for this purpose.

Thanks

Steve replied on : 59 of 119

Rudi—The concept of marker-controlled watershed segmentation is quite general, and might apply to your problem. I would expect the details to be very difficult to work out, however.

Chris replied on : 60 of 119

hi steve,

thanks for this suggestion of the cell segmentation. i have got a question: have you ever implement the pyramid linking algorithm from J. Burt? i am on a similar problem like this cell segmentation. but we’ve got colonies and sometimes the edges are blurred and sometimes they are sharp! if you want i can send you some pictures of these colonies!?!

Thanks
Chris

Steve replied on : 61 of 119

Chris—No, I’m not familiar with that method.

Rupesh Tatiya replied on : 62 of 119

Steve,

I have a similar image segmentation problem at hand where we have the RGB color image of human face and the objective is to segment the eyebrow from the rest of the face. I have tried different algorithms given in various tutorials but they do not work with good enough. So, can you help me in this matter?

Thanks and Regards,

Rupesh Tatiya

Steve replied on : 63 of 119

Rupesh—No, I generally do not have the time available to provide custom algorithm development advice for particular datasets.

Shannon replied on : 64 of 119

i am not sure if this has already been addressed/answered. I used code like yours, and incorporated what you did for segmentation.

I need to create code to count the specific cells once thresholded. like that produced a single number of the cell count, like 18.

i think i need a for loop, but i’m not really strong in matlab, so i was wondering if you knew how to count pixels in order to cell count or what… maybe had sample code or language to steer me in the right direction? THANK YOU!

shannon

Pradeep replied on : 65 of 119

Hi Steve
I am planning to do something on cell segmentation. But I am not an expert. I need your help. I need in areas of calculating more accurate cell density by keeping in mind: Partial Cell, Non-cell area and overlap cell. One more area i want to focus on is auto threshold if you have any ideas regarding this plz let me knw

Thanks

Steve replied on : 66 of 119

Shannon—Try this:

[L, num_cells] = bwlabel(segmented_cell_image);

Steve replied on : 67 of 119

Pradeep—Are your cells reasonably circular? If so, you might consider trying a circular Hough transform. There are many different variations on the literature. There’s at least one available on the MATLAB Central File Exchange.

Pradeep replied on : 68 of 119

thnx steve
i have one more question. why we only use black and white image for cell segmentation. like if we have any color image we first convert it to a grayscale.

Steve replied on : 69 of 119

Pradeep—It is convenient to use a binary (black and white) image to represent the outcome of the fundamental segmentation idea: Choosing which pixels belong to objects of interest, and which pixels belong to the background.

Sam replied on : 70 of 119

Hi ,
How can I identify objects with intermediate intensities in a image(there are bright objects, medium bright objects and the background), when the region around the brighter objects(glow around the bright objects) are of similar intensities to the medium intensity objects and needs to be excluded !

Tilman Sauter replied on : 71 of 119

Dear Sir,

I have developed a 3D image deconvolution code using the approximate method described in “Digital Image Processing, Castleman”. It uses the out of focus microscope images and the out of focus PSF images to determine the ‘noise’, which is then subtracted from the in-focus micrsocope image.

Now I would like to use for example the deconvlucy() function provided by Matlab to do the same thing in order to compare both.

Is it possible to work with out of focus planes in any of matlabs deconvolution functions to achieve 3D image deconvolution?

Tilman

Steve replied on : 72 of 119

Tilman—I don’t have the Castleman reference handy. Can elaborate on what you mean by “work with out of focus planes”?

Tilman Sauter replied on : 73 of 119

Dear Sir,

Thank you for your fast reply. The code I implemented is based on a simple equation:
in-focus-object = in-focus-image – sum(lower-out-of-focus-image convoluted with lower-out-of-focus-PSF + higher-out-of-focus-image convoluted with higher out-of-focus-PSF).
The sum sign defines the number of adjacent planes used, image the obtained image from the microscope and object the deconvoluted image.

The important thing is, that I can use information from the adjacent planes to improve the in-focus-object, whereas with deconvlucy() I can only use the information of the in-focus-image and in-focus-PSF.

Do you think it is possible to use deconvlucy() or another deconvolution function to achieve a comparable result?

With best regards
Tilman

Steve replied on : 74 of 119

Tilman—No, none of the deconvolution methods in the Image Processing Toolbox implement that technique. You would need to modify them yourself.

Steve replied on : 75 of 119

Sam—It’s hard to say without seeing a sample. Sounds like you have a difficult segmentation problem. If the object boundaries are reasonably well-defined, it might be helpful to use the gradient magnitude image.

Jon Hauris replied on : 76 of 119

Steve, I am interested in texture processing. Is there a way to search your excellent archives to see if you have covered this area and where it is located. Thank you, Jon

Steve replied on : 77 of 119

Jon—There is a MATLAB Central search box at the top of the page. You can limit the scope of the search to MATLAB Central blogs. Or you can click on the “Blog archive” link in the side panel. I haven’t written that much about texture analysis, though. You might want to try the texture analysis section in the toolbox documentation.

Giles Kingsley replied on : 78 of 119

Steve,

I have an image of a metal plate from a time-lapse series. There is a grid in the background, which I want to remove. Does this sound like a morphological operation? Throw me a bone here. Edge detection just enhances the grid, and thresholding removes area(my output) from the plate. Any ideas?
-Giles

Steve replied on : 79 of 119

Giles—An opening (IMOPEN) might work. How thick is the grid, and how thick is the object(s) of interest?

IB replied on : 80 of 119

I get the following error when I follow the commands here
“Undefined function or method ‘imoverlay’ for input arguments of type ‘uint8′.”
How could I overcome this error?

Steve replied on : 81 of 119

IB—The third paragraph in this blog post tells you how to get the function imoverlay.

IB replied on : 82 of 119

Steve do you mean the cell segmentation blog? I did not found it in the cell segmentation blog

Steve replied on : 83 of 119

IB—In this blog post, the very one you are commenting on, the third paragraph says “Note: you can download the functions imcredit and imoverlay from MATLAB Central.” The links are provided there.

azhagumani replied on : 84 of 119

i want to expand a region and find out what are all label values it reached.

Steve replied on : 85 of 119

Azhagumani—Form a binary image whose foreground is the region you are interested in, and then dilate it. Then use the dilated image as a logical mask into the original labeled image; that will pull out all the labels adjacent to the original labeled region.

huda replied on : 86 of 119

Hye.. I’m new to this image processing things.. I was told to make an image segmentation of a picture.. The image consists of 3 shapes that overlapping each other.. It was a grayscale image but with 3 different tones of gray colour.. The task was to convert to binary format first and then segment the shape individually.. If during the segmentation, the shape missing some portion, I have to complete the missing portion.. So, can you tell me how to do it in Matlab? And I wonder do I have to set a threshold value?

Steve replied on : 87 of 119

Huda—It’s difficult in general to reconstruct overlapping shapes in a segmentation problem. It’s easier for some specific shapes, though. For example, if your shapes are circles, you could use a circular Hough transform. Hough-like algorithms can often detect a partially occluded shape. The Image Processing Toolbox does not have a circular Hough algorithm, but there’s at least one available on the MATLAB Central File Exchange.

huda replied on : 88 of 119

The shapes are circle, square and rectangle.. Can i used the Hough transform for these shapes? And for the segmentation? How to do it?

Steve replied on : 89 of 119

Huda—The problem sounds kind of contrived. I don’t have any particular suggestions.

Chris Soton replied on : 90 of 119

Hi Steve,

I am MATLAB beginner and I am using a similar image to this example. I have converted my nuclei image to binary and used bwlabel to count the nuclei. However I would like to measure the distance between cell nuclei from a central point on each nuclei (centroid), but I am struggling with the code. Is there any coding help or pointers you could give me with this please?

Thanks,

Chris

Steve replied on : 91 of 119

Chris—You can pass the output of bwlabel to regionprops to get the centroid of each labeled object.

ragu replied on : 92 of 119

hi, steve
i want to develop a general algorithm for image resulting from watershed to display how many pixel occupied in each segment and average intensity of each segment .so that i need variables to sum up the the pixel and average intensity. for limited segment i can develop with specific variables but for generalize i need to get variables which should generate depends on how many segments from watershed output.

Chris Soton replied on : 93 of 119

Hi Steve,

Thanks for the reply, I am sorry but I think I was not clear. I have obtained the centroids of my cells and am struggling to get the distance between the centriods. I would like the code to automatically get the distance between all centriods.

I have tried imdistline but this seems to be a manual code and my attempts to pass the centriod data to this code have failed. Please could you give me any sample code or pointers?

Thanks,

Chris

Steve replied on : 94 of 119

Ragu—You can pass the output from watershed to the function regionprops in order to calculate the desired measurements for each labeled region.

Steve replied on : 95 of 119

Chris—Try something like this:

dist = hypot(centroid1 - centroid2);

Stefan replied on : 96 of 119

Hello Steve!

First of all I’d like to say that I very appreciate your Help here in this Blog. You’re amazing!
I have a similar problem like those discussed here. I have an Image where you can find lots of small cruxes (+), which are all different orientated. I would like to get a contour on every single crux, like you did it on the cells on top of this site. My problem is that i cant isolate the cruxes so i always get connected regions.

The image is here: stud.unileoben.ac.at/~m0335168/RC7.jpg

Thanks a lot!

Steve replied on : 97 of 119

Stefan—I’m sorry, but I don’t have specific suggestions for you.

Chris Soton replied on : 98 of 119

Thanks Steve! Your code combined with another of your examples has helped me greatly.

Ragu replied on : 99 of 119

hi steve
right now i dont have imoverlay function in 6.5.1 version

can you give any function to do the same

or how to develop algorithm

Steve replied on : 100 of 119

kavitha replied on : 101 of 119

Hi Steve.
Its a great page. I got answres for a lot of questions. and in my project i have two images for a same object. I ve segmented those two objects. but i need to calculate the area difference between those objects. how can i do this. pls help me.

Steve replied on : 102 of 119

Kavitha—Use bwlabel and regionprops.

kavitha replied on : 103 of 119

k. steve…. thank u for ur reply. i refered the page which u wrote abt bwlabel.Ur work and discussion are very useful to students like us.. Those examples helped me a lot…

Ragu replied on : 104 of 119

hi steve thanks for the reply

now i have two questions .

1.how many ways are there to make markers.

2.i need to make marker on my gray image before apply to watershed in order to segment the defects(black in color).

where should i make marker either on black parts or gray parts.

Steve replied on : 105 of 119

Ragu—Take a look at the marker-controlled watershed segmentation demo in the Image Processing Toolbox (you can also find it on our web site). You might also be interested in my watershed article in News and Notes from a few years ago.

ragu replied on : 106 of 119

in water marking
fore ground marking is based on the imregionalmin or imregionalmax followed by imclose ,imfill, bwareaopen.

in back ground marking i have little confussion of super imposing fore ground and back ground marker images on gradiant magnitude image rather than original gray image.

Steve replied on : 107 of 119

Ragu—I’m not sure exactly what your question is. Whether to use the original image, the gradient magnitude image, or some other derived image depends on your data set and your chosen method for extracting markers.

ragu replied on : 108 of 119

hi steve thanks for the question,
i have made foreground markers and background markers as per my region of interest.

now should i impose these on original image or gradiant magnitude image.

in example of matlab watermarking it mentioned magnitude gradient.
why?

i belive that imposing markers on original gray image is logically good. if it is not .why?

ragu replied on : 109 of 119

im sorry i forgot to mention that ,my ultimate aim to get segmentation of defects on gray image which is in dark portion ,by applying watershed transform.

for this i need markers to reduce oversegmentation, .

Steve replied on : 110 of 119

Ragu—In my comment #105, I gave a link to my News & Notes article on the watershed transform, which explains the basic concepts of using the transform for segmentation. I encourage you to take a look at it. Here’s an important sentence: “The key behind using the watershed transform for segmentation is this: Change your image into another image whose catchment basins are the objects you want to identify.” Often, the original grayscale image does not have the property that its catchment basins correspond to the objects you are trying to segment. Markers, minima imposition, computing gradient magnitudes, etc., are all techniques for making that happen.

Pratyusha replied on : 111 of 119

HI Steve,
I have a similar problem with segmentation of tumors in an Ultrasound image.
I use a .jpg image file and edge detection techniques, but most of the times it does not work, as the background of an US image is not that clear, i.e., there is a very smooth gradient. I could send/upload some of the files (Images) so you can have a look at them.
Please suggest a suitable edge detection technique for these kind of images.

Thank you!

Steve replied on : 112 of 119

Pratyusha—I don’t have any suggestions for you.

Pratyusha replied on : 113 of 119

Thank you for letting me know. I will try to use a kalman filter for it, or color code the image to highlight the tumor areas.

Francesco replied on : 114 of 119

Goodmorning,
in my engineering degree study i have to make a microstructural characterization of open cell aluminium foams.
After i have done a watershed transform on my 2D slice i have to do a masking of the complement of the binary starting image and the watershed one to reduce the oversegmentation but i don’t know how to make this.

Steve replied on : 115 of 119

Francesco—This blog post has some example code. You might also want to look at the watershed segmentation demo in the Image Processing Toolbox.

Francesco replied on : 116 of 119

thresh=40;
BW=(I>40);
D=bwdist(I1,’euclidean’);
D1=imcomplement(D1);
H=imhmin(D1,13,6);
L=watershed(H);
d=imcomplement(BW)&L;
Now i have reconstructed my open cell foam but if i want to make a geometrical analysis it seems to be that the image has only one region instead of hundreds,because matlab doesn’t recognize that there are many regions.
How i can make to solve this problem??

Steve replied on : 117 of 119

Francesco—It’s your algorithm that doesn’t recognize that there are many regions. It’s hard to say for sure without looking at your image, but I’m not sure I understand why all your steps make sense. You might want to take a look at my News & Notes article about watershed-based segmentation.

deXter Holland replied on : 118 of 119

http://img3.imageshack.us/my.php?image=sample01.jpg

hi all! i need to do cell detection on the image above (identify the presence of those ‘big’ cells). my main problem is the background (noise), i couldn’t remove them properly, so i couldn’t do the usual segmentation easily. for now i’m processing it on grayscale, based on the materials i’m reading.
any suggestion?

Steve replied on : 119 of 119

Dexter—You might try using bwareaopen to remove the small “noise” objects detected.

These postings are the author's and don't necessarily represent the opinions of MathWorks.


text:
# BRST cohomology of Yang-Mills gauge fields in the presence of gravity in Ashtekar variables

Research paper by O. Moritsch, M. Schweda, T. Sommer, L. Tataru, H. Zerrouki

Indexed on: 14 Sep '94Published on: 14 Sep '94Published in: High Energy Physics - Theory

#### Abstract

The BRST transformations for the Yang-Mills gauge fields in the presence of gravity described by Ashtekar variables are obtained by using the so-called Maurer-Cartan horizontality conditions. The BRST cohomology group expressed by the Wess-Zumino consistency condition is solved with the help of an operator $\delta$ introduced by S.P. Sorella which in our case has a very simple form and generates, together with the differential $d$ and the BRST operator $s$, a simpler algebra than in the pure Yang-Mills theory. In this way we shall find the Yang-Mills Lagrangians, the Chern-Simons terms and the gauge anomalies.

format: plain


text:
## Algebra: A Combined Approach (4th Edition)

$-6$
$-2-4=-6$ Same sign numbers are added to one another whilst keeping the sign.


text:
# Binary relation

(Redirected from Relation (mathematics))
Jump to: navigation, search
"Relation (mathematics)" redirects here. For a more general notion of relation, see finitary relation. For a more combinatorial viewpoint, see theory of relations. For other uses, see Relation § Mathematics.

In mathematics, a binary relation on a set A is a collection of ordered pairs of elements of A. In other words, it is a subset of the Cartesian product A2 = A × A. More generally, a binary relation between two sets A and B is a subset of A × B. The terms correspondence, dyadic relation and 2-place relation are synonyms for binary relation.

An example is the "divides" relation between the set of prime numbers P and the set of integers Z, in which every prime p is associated with every integer z that is a multiple of p (but with no integer that is not a multiple of p). In this relation, for instance, the prime 2 is associated with numbers that include −4, 0, 6, 10, but not 1 or 9; and the prime 3 is associated with numbers that include 0, 6, and 9, but not 4 or 13.

Binary relations are used in many branches of mathematics to model concepts like "is greater than", "is equal to", and "divides" in arithmetic, "is congruent to" in geometry, "is adjacent to" in graph theory, "is orthogonal to" in linear algebra and many more. The concept of function is defined as a special kind of binary relation. Binary relations are also heavily used in computer science.

A binary relation is the special case n = 2 of an n-ary relation R ⊆ A1 × … × An, that is, a set of n-tuples where the jth component of each n-tuple is taken from the jth domain Aj of the relation. An example for a ternary relation on Z×Z×Z is "lies between ... and ...", containing e.g. the triples (5,2,8), (5,8,2), and (−4,9,−7).

In some systems of axiomatic set theory, relations are extended to classes, which are generalizations of sets. This extension is needed for, among other things, modeling the concepts of "is an element of" or "is a subset of" in set theory, without running into logical inconsistencies such as Russell's paradox.

## Formal definition

A binary relation R is usually defined as an ordered triple (X, Y, G) where X and Y are arbitrary sets (or classes), and G is a subset of the Cartesian product X × Y. The sets X and Y are called the domain (or the set of departure) and codomain (or the set of destination), respectively, of the relation, and G is called its graph.

The statement (x,y) ∈ G is read "x is R-related to y", and is denoted by xRy or R(x,y). The latter notation corresponds to viewing R as the characteristic function on X × Y for the set of pairs of G.

The order of the elements in each pair of G is important: if ab, then aRb and bRa can be true or false, independently of each other. Resuming the above example, the prime 3 divides the integer 9, but 9 doesn't divide 3.

A relation as defined by the triple (X, Y, G) is sometimes referred to as a correspondence instead.[1] In this case the relation from X to Y is the subset G of X × Y, and "from X to Y" must always be either specified or implied by the context when referring to the relation. In practice correspondence and relation tend to be used interchangeably.

### Is a relation more than its graph?

According to the definition above, two relations with identical graphs but different domains or different codomains are considered different. For example, if $G = \{(1,2),(1,3),(2,7)\}$, then $(\mathbb{Z},\mathbb{Z}, G)$, $(\mathbb{R}, \mathbb{N}, G)$, and $(\mathbb{N}, \mathbb{R}, G)$ are three distinct relations, where $\mathbb{Z}$ is the set of integers and $\mathbb{R}$ is the set of real numbers.

Especially in set theory, binary relations are often defined as sets of ordered pairs, identifying binary relations with their graphs. The domain of a binary relation $R$ is then defined as the set of all $x$ such that there exists at least one $y$ such that $(x,y) \in R$, the range of $R$ is defined as the set of all $y$ such that there exists at least one $x$ such that $(x,y) \in R$, and the field of $R$ is the union of its domain and its range.[2][3][4]

A special case of this difference in points of view applies to the notion of function. Many authors insist on distinguishing between a function's codomain and its range. Thus, a single "rule," like mapping every real number x to x2, can lead to distinct functions $f: \mathbb{R} \rightarrow \mathbb{R}$ and $f: \mathbb{R} \rightarrow \mathbb{R}^+$, depending on whether the images under that rule are understood to be reals or, more restrictively, non-negative reals. But others view functions as simply sets of ordered pairs with unique first components. This difference in perspectives does raise some nontrivial issues. As an example, the former camp considers surjectivity—or being onto—as a property of functions, while the latter sees it as a relationship that functions may bear to sets.

Either approach is adequate for most uses, provided that one attends to the necessary changes in language, notation, and the definitions of concepts like restrictions, composition, inverse relation, and so on. The choice between the two definitions usually matters only in very formal contexts, like category theory.

### Example

2nd example relation
ball car doll gun
John + - - -
Mary - - + -
Venus - + - -
1st example relation
ball car doll gun
John +
Mary +
Ian
Venus -− +

Example: Suppose there are four objects {ball, car, doll, gun} and four persons {John, Mary, Ian, Venus}. Suppose that John owns the ball, Mary owns the doll, and Venus owns the car. Nobody owns the gun and Ian owns nothing. Then the binary relation "is owned by" is given as

R = ({ball, car, doll, gun}, {John, Mary, Ian, Venus}, {(ball, John), (doll, Mary), (car, Venus)}).

Thus the first element of R is the set of objects, the second is the set of persons, and the last element is a set of ordered pairs of the form (object, owner).

The pair (ball, John), denoted by ballRJohn means that the ball is owned by John.

Two different relations could have the same graph. For example: the relation

({ball, car, doll, gun}, {John, Mary, Venus}, {(ball, John), (doll, Mary), (car, Venus)})

is different from the previous one as everyone is an owner. But the graphs of the two relations are the same.

Nevertheless, R is usually identified or even defined as G(R) and "an ordered pair (x, y) ∈ G(R)" is usually denoted as "(x, y) ∈ R".

## Special types of binary relations

Example relations between real numbers. Red: y=x2. Green: y=2x+20.

Some important types of binary relations R between two sets X and Y are listed below. To emphasize that X and Y can be different sets, some authors call such binary relations heterogeneous.[5][6]

Uniqueness properties:

• injective (also called left-unique[7]): for all x and z in X and y in Y it holds that if xRy and zRy then x = z. For example, the green relation in the diagram is injective, but the red relation is not, as it relates e.g. both x = −5 and z = +5 to y = 25.
• functional (also called univalent[8] or right-unique[7] or right-definite[9]): for all x in X, and y and z in Y it holds that if xRy and xRz then y = z; such a binary relation is called a partial function. Both relations in the picture are functional. An example for a non-functional relation can be obtained by rotating the red graph clockwise by 90 degrees, i.e. by considering the relation x=y2 which relates e.g. x=25 to both y=-5 and z=+5.
• one-to-one (also written 1-to-1): injective and functional. The green relation is one-to-one, but the red is not.

Totality properties:

• left-total:[7] for all x in X there exists a y in Y such that xRy. For example R is left-total when it is a function or a multivalued function. Note that this property, although sometimes also referred to as total, is different from the definition of total in the next section. Both relations in the picture are left-total. The relation x=y2, obtained from the above rotation, is not left-total, as it doesn't relate, e.g., x = −14 to any real number y.
• surjective (also called right-total[7] or onto): for all y in Y there exists an x in X such that xRy. The green relation is surjective, but the red relation is not, as it doesn't relate any real number x to e.g. y = −14.

Uniqueness and totality properties:

• A function: a relation that is functional and left-total. Both the green and the red relation are functions.
• An injective function: a relation that is injective, functional, and left-total.
• A surjective function or surjection: a relation that is functional, left-total, and right-total.
• A bijection: a surjective one-to-one or surjective injective function is said to be bijective, also known as one-to-one correspondence.[10] The green relation is bijective, but the red is not.

### Difunctional

Less commonly encountered is the notion of difunctional (or regular) relation, defined as a relation R such that R=RR−1R.[11]

To understand this notion better, it helps to consider a relation as mapping every element xX to a set xR = { yY | xRy }.[11] This set is sometimes called the successor neighborhood of x in R; one can define the predecessor neighborhood analogously.[12] Synonymous terms for these notions are afterset and respectively foreset.[5]

A difunctional relation can then be equivalently characterized as a relation R such that wherever x1R and x2R have a non-empty intersection, then these two sets coincide; formally x1Rx2R implies x1R = x2R.[11]

As examples, any function or any functional (right-unique) relation is difunctional; the converse doesn't hold. If one considers a relation R from set to itself (X = Y), then if R is both transitive and symmetric (i.e. a partial equivalence relation), then it is also difunctional.[13] The converse of this latter statement also doesn't hold.

A characterization of difunctional relations, which also explains their name, is to consider two functions f: AC and g: BC and then define the following set which generalizes the kernel of a single function as joint kernel: ker(f, g) = { (a, b) ∈ A × B | f(a) = g(b) }. Every difunctional relation RA × B arises as the joint kernel of two functions f: AC and g: BC for some set C.[14]

In automata theory, the term rectangular relation has also been used to denote a difunctional relation. This terminology is justified by the fact that when represented as a boolean matrix, the columns and rows of a difunctional relation can be arranged in such a way as to present rectangular blocks of true on the (asymmetric) main diagonal.[15] Other authors however use the term "rectangular" to denote any heterogeneous relation whatsoever.[6]

## Relations over a set

If X = Y then we simply say that the binary relation is over X, or that it is an endorelation over X.[16] In computer science, such a relation is also called a homogeneous (binary) relation.[16][17][6] Some types of endorelations are widely studied in graph theory, where they are known as simple directed graphs permitting loops.

The set of all binary relations Rel(X) on a set X is the set 2X × X which is a Boolean algebra augmented with the involution of mapping of a relation to its inverse relation. For the theoretical explanation see Relation algebra.

Some important properties of a binary relation R over a set X are:

• reflexive: for all x in X it holds that xRx. For example, "greater than or equal to" (≥) is a reflexive relation but "greater than" (>) is not.
• irreflexive (or strict): for all x in X it holds that not xRx. For example, > is an irreflexive relation, but ≥ is not.
• coreflexive: for all x and y in X it holds that if xRy then x = y. An example of a coreflexive relation is the relation on integers in which each odd number is related to itself and there are no other relations. The equality relation is the only example of a both reflexive and coreflexive relation.
The previous 3 alternatives are far from being exhaustive; e.g. the red relation y=x2 from the above picture is neither irreflexive, nor coreflexive, nor reflexive, since it contains the pair (0,0), and (2,4), but not (2,2), respectively.
• symmetric: for all x and y in X it holds that if xRy then yRx. "Is a blood relative of" is a symmetric relation, because x is a blood relative of y if and only if y is a blood relative of x.
• antisymmetric: for all x and y in X, if xRy and yRx then x = y. For example, ≥ is anti-symmetric (so is >, but only because the condition in the definition is always false).[18]
• asymmetric: for all x and y in X, if xRy then not yRx. A relation is asymmetric if and only if it is both anti-symmetric and irreflexive.[19] For example, > is asymmetric, but ≥ is not.
• transitive: for all x, y and z in X it holds that if xRy and yRz then xRz. A transitive relation is irreflexive if and only if it is asymmetric.[20] For example, "is ancestor of" is transitive, while "is parent of" is not.
• total: for all x and y in X it holds that xRy or yRx (or both). This definition for total is different from left total in the previous section. For example, ≥ is a total relation.
• trichotomous: for all x and y in X exactly one of xRy, yRx or x = y holds. For example, > is a trichotomous relation, while the relation "divides" on natural numbers is not.[21]
• Right Euclidean: for all x, y and z in X it holds that if xRy and xRz, then yRz.
• Left Euclidean: for all x, y and z in X it holds that if yRx and zRx, then yRz.
• Euclidean: An Euclidean relation is both left and right Euclidean. Equality is a Euclidean relation because if x=y and x=z, then y=z.
• serial: for all x in X, there exists y in X such that xRy. "Is greater than" is a serial relation on the integers. But it is not a serial relation on the positive integers, because there is no y in the positive integers (i.e. the natural numbers) such that 1>y.[22] However, "is less than" is a serial relation on the positive integers, the rational numbers and the real numbers. Every reflexive relation is serial: for a given x, choose y=x. A serial relation can be equivalently characterized as every element having a non-empty successor neighborhood (see the previous section for the definition of this notion). Similarly an inverse serial relation is a relation in which every element has non-empty predecessor neighborhood.[12]
• set-like (or local): for every x in X, the class of all y such that yRx is a set. (This makes sense only if relations on proper classes are allowed.) The usual ordering < on the class of ordinal numbers is set-like, while its inverse > is not.

A relation that is reflexive, symmetric, and transitive is called an equivalence relation. A relation that is symmetric, transitive, and serial is also reflexive. A relation that is only symmetric and transitive (without necessarily being reflexive) is called a partial equivalence relation.

A relation that is reflexive, antisymmetric, and transitive is called a partial order. A partial order that is total is called a total order, simple order, linear order, or a chain.[23] A linear order where every nonempty subset has a least element is called a well-order.

 reflexive symmetric transitive symbol example directed graph → undirected graph No Yes tournament No No pecking order dependency Yes Yes weak order Yes ≤ preorder Yes Yes ≤ preference partial order Yes No Yes ≤ subset partial equivalence Yes Yes equivalence relation Yes Yes Yes ∼, ≅, ≈, ≡ equality strict partial order No No Yes < proper subset

## Operations on binary relations

If R, S are binary relations over X and Y, then each of the following is a binary relation over X and Y:

• Union: RSX × Y, defined as RS = { (x, y) | (x, y) ∈ R or (x, y) ∈ S }. For example, ≥ is the union of > and =.
• Intersection: RSX × Y, defined as RS = { (x, y) | (x, y) ∈ R and (x, y) ∈ S }.

If R is a binary relation over X and Y, and S is a binary relation over Y and Z, then the following is a binary relation over X and Z: (see main article composition of relations)

• Composition: S ∘ R, also denoted R;S (or more ambiguously[clarification needed] R ∘ S), defined as S ∘ R = { (x, z) | there exists yY, such that (x, y) ∈ R and (y, z) ∈ S }. The order of R and S in the notation S ∘ R, used here agrees with the standard notational order for composition of functions. For example, the composition "is mother of" ∘ "is parent of" yields "is maternal grandparent of", while the composition "is parent of" ∘ "is mother of" yields "is grandmother of".

A relation R on sets X and Y is said to be contained in a relation S on X and Y if R is a subset of S, that is, if x R y always implies x S y. In this case, if R and S disagree, R is also said to be smaller than S. For example, > is contained in ≥.

If R is a binary relation over X and Y, then the following is a binary relation over Y and X:

• Inverse or converse: R −1, defined as R −1 = { (y, x) | (x, y) ∈ R }. A binary relation over a set is equal to its inverse if and only if it is symmetric. See also duality (order theory). For example, "is less than" (<) is the inverse of "is greater than" (>).

If R is a binary relation over X, then each of the following is a binary relation over X:

• Reflexive closure: R=, defined as R= = { (x, x) | xX } ∪ R or the smallest reflexive relation over X containing R. This can be proven to be equal to the intersection of all reflexive relations containing R.
• Reflexive reduction: R, defined as R = R \ { (x, x) | xX } or the largest irreflexive relation over X contained in R.
• Transitive closure: R+, defined as the smallest transitive relation over X containing R. This can be seen to be equal to the intersection of all transitive relations containing R.
• Transitive reduction: R, defined as a[clarification needed] minimal relation having the same transitive closure as R.
• Reflexive transitive closure: R *, defined as R * = (R+) =, the smallest preorder containing R.
• Reflexive transitive symmetric closure: R, defined as the smallest equivalence relation over X containing R.

### Complement

If R is a binary relation over X and Y, then the following too:

• The complement S is defined as x S y if not x R y. For example, on real numbers, ≤ is the complement of >.

The complement of the inverse is the inverse of the complement.

If X = Y, the complement has the following properties:

• If a relation is symmetric, the complement is too.
• The complement of a reflexive relation is irreflexive and vice versa.
• The complement of a strict weak order is a total preorder and vice versa.

The complement of the inverse has these same properties.

### Restriction

The restriction of a binary relation on a set X to a subset S is the set of all pairs (x, y) in the relation for which x and y are in S.

If a relation is reflexive, irreflexive, symmetric, antisymmetric, asymmetric, transitive, total, trichotomous, a partial order, total order, strict weak order, total preorder (weak order), or an equivalence relation, its restrictions are too.

However, the transitive closure of a restriction is a subset of the restriction of the transitive closure, i.e., in general not equal. For example, restricting the relation "x is parent of y" to females yields the relation "x is mother of the woman y"; its transitive closure doesn't relate a woman with her paternal grandmother. On the other hand, the transitive closure of "is parent of" is "is ancestor of"; its restriction to females does relate a woman with her paternal grandmother.

Also, the various concepts of completeness (not to be confused with being "total") do not carry over to restrictions. For example, on the set of real numbers a property of the relation "≤" is that every non-empty subset S of R with an upper bound in R has a least upper bound (also called supremum) in R. However, for a set of rational numbers this supremum is not necessarily rational, so the same property does not hold on the restriction of the relation "≤" to the set of rational numbers.

The left-restriction (right-restriction, respectively) of a binary relation between X and Y to a subset S of its domain (codomain) is the set of all pairs (x, y) in the relation for which x (y) is an element of S.

### Algebras, categories, and rewriting systems

Various operations on binary endorelations can be treated as giving rise to an algebraic structure, known as relation algebra. It should not be confused with relational algebra which deals in finitary relations (and in practice also finite and many-sorted).

For heterogenous binary relations, a category of relations arises.[6]

Despite their simplicity, binary relations are at the core of an abstract computation model known as an abstract rewriting system.

## Sets versus classes

Certain mathematical "relations", such as "equal to", "member of", and "subset of", cannot be understood to be binary relations as defined above, because their domains and codomains cannot be taken to be sets in the usual systems of axiomatic set theory. For example, if we try to model the general concept of "equality" as a binary relation =, we must take the domain and codomain to be the "class of all sets", which is not a set in the usual set theory.

In most mathematical contexts, references to the relations of equality, membership and subset are harmless because they can be understood implicitly to be restricted to some set in the context. The usual work-around to this problem is to select a "large enough" set A, that contains all the objects of interest, and work with the restriction =A instead of =. Similarly, the "subset of" relation ⊆ needs to be restricted to have domain and codomain P(A) (the power set of a specific set A): the resulting set relation can be denoted ⊆A. Also, the "member of" relation needs to be restricted to have domain A and codomain P(A) to obtain a binary relation ∈A that is a set. Bertrand Russell has shown that assuming ∈ to be defined on all sets leads to a contradiction in naive set theory.

Another solution to this problem is to use a set theory with proper classes, such as NBG or Morse–Kelley set theory, and allow the domain and codomain (and so the graph) to be proper classes: in such a theory, equality, membership, and subset are binary relations without special comment. (A minor modification needs to be made to the concept of the ordered triple (X, Y, G), as normally a proper class cannot be a member of an ordered tuple; or of course one can identify the function with its graph in this context.)[24] With this definition one can for instance define a function relation between every set and its power set.

## The number of binary relations

The number of distinct binary relations on an n-element set is 2n2 (sequence A002416 in OEIS):

Number of n-element binary relations of different types
n all transitive reflexive preorder partial order total preorder total order equivalence relation
0 1 1 1 1 1 1 1 1
1 2 2 1 1 1 1 1 1
2 16 13 4 4 3 3 2 2
3 512 171 64 29 19 13 6 5
4 65536 3994 4096 355 219 75 24 15
OEIS A002416 A006905 A053763 A000798 A001035 A000670 A000142 A000110

Notes:

• The number of irreflexive relations is the same as that of reflexive relations.
• The number of strict partial orders (irreflexive transitive relations) is the same as that of partial orders.
• The number of strict weak orders is the same as that of total preorders.
• The total orders are the partial orders that are also total preorders. The number of preorders that are neither a partial order nor a total preorder is, therefore, the number of preorders, minus the number of partial orders, minus the number of total preorders, plus the number of total orders: 0, 0, 0, 3, and 85, respectively.
• the number of equivalence relations is the number of partitions, which is the Bell number.

The binary relations can be grouped into pairs (relation, complement), except that for n = 0 the relation is its own complement. The non-symmetric ones can be grouped into quadruples (relation, complement, inverse, inverse complement).

## Notes

1. ^ Encyclopedic dictionary of Mathematics. MIT. 2000. pp. 1330–1331. ISBN 0-262-59020-4.
2. ^ Suppes, Patrick (1972) [originally published by D. van Nostrand Company in 1960]. Axiomatic Set Theory. Dover. ISBN 0-486-61630-4.
3. ^ Smullyan, Raymond M.; Fitting, Melvin (2010) [revised and corrected republication of the work originally published in 1996 by Oxford University Press, New York]. Set Theory and the Continuum Problem. Dover. ISBN 978-0-486-47484-7.
4. ^ Levy, Azriel (2002) [republication of the work published by Springer-Verlag, Berlin, Heidelberg and New York in 1979]. Basic Set Theory. Dover. ISBN 0-486-42079-5.
5. ^ a b Christodoulos A. Floudas; Panos M. Pardalos (2008). Encyclopedia of Optimization (2nd ed.). Springer Science & Business Media. pp. 299–300. ISBN 978-0-387-74758-3.
6. ^ a b c d Michael Winter (2007). Goguen Categories: A Categorical Approach to L-fuzzy Relations. Springer. pp. x–xi. ISBN 978-1-4020-6164-6.
7. ^ a b c d Kilp, Knauer and Mikhalev: p. 3. The same four definitions appear in the following:
• Peter J. Pahl; Rudolf Damrath (2001). Mathematical Foundations of Computational Engineering: A Handbook. Springer Science & Business Media. p. 506. ISBN 978-3-540-67995-0.
• Eike Best (1996). Semantics of Sequential and Parallel Programs. Prentice Hall. pp. 19–21. ISBN 978-0-13-460643-9.
• Robert-Christoph Riemann (1999). Modelling of Concurrent Systems: Structural and Semantical Methods in the High Level Petri Net Calculus. Herbert Utz Verlag. pp. 21–22. ISBN 978-3-89675-629-9.
8. ^ Gunther Schmidt, 2010. Relational Mathematics. Cambridge University Press, ISBN 978-0-521-76268-7, Chapt. 5
9. ^ Mäs, Stephan (2007), "Reasoning on Spatial Semantic Integrity Constraints", Spatial Information Theory: 8th International Conference, COSIT 2007, Melbourne, Australiia, September 19–23, 2007, Proceedings, Lecture Notes in Computer Science 4736, Springer, pp. 285–302, doi:10.1007/978-3-540-74788-8_18
10. ^ Note that the use of "correspondence" here is narrower than as general synonym for binary relation.
11. ^ a b c Chris Brink; Wolfram Kahl; Gunther Schmidt (1997). Relational Methods in Computer Science. Springer Science & Business Media. p. 200. ISBN 978-3-211-82971-4.
12. ^ a b Yao, Y. (2004). "Semantics of Fuzzy Sets in Rough Set Theory". Transactions on Rough Sets II. Lecture Notes in Computer Science 3135. p. 297. doi:10.1007/978-3-540-27778-1_15. ISBN 978-3-540-23990-1. edit
13. ^ William Craig (2006). Semigroups Underlying First-order Logic. American Mathematical Soc. p. 72. ISBN 978-0-8218-6588-0.
14. ^ Gumm, H. P.; Zarrad, M. (2014). "Coalgebraic Simulations and Congruences". Coalgebraic Methods in Computer Science. Lecture Notes in Computer Science 8446. p. 118. doi:10.1007/978-3-662-44124-4_7. ISBN 978-3-662-44123-7. edit
15. ^ Julius Richard Büchi (1989). Finite Automata, Their Algebras and Grammars: Towards a Theory of Formal Expressions. Springer Science & Business Media. pp. 35–37. ISBN 978-1-4613-8853-1.
16. ^ a b M. E. Müller (2012). Relational Knowledge Discovery. Cambridge University Press. p. 22. ISBN 978-0-521-19021-3.
17. ^ Peter J. Pahl; Rudolf Damrath (2001). Mathematical Foundations of Computational Engineering: A Handbook. Springer Science & Business Media. p. 496. ISBN 978-3-540-67995-0.
18. ^ Smith, Douglas; Eggen, Maurice; St. Andre, Richard (2006), A Transition to Advanced Mathematics (6th ed.), Brooks/Cole, p. 160, ISBN 0-534-39900-2
19. ^ Nievergelt, Yves (2002), Foundations of Logic and Mathematics: Applications to Computer Science and Cryptography, Springer-Verlag, p. 158.
20. ^ Flaška, V.; Ježek, J.; Kepka, T.; Kortelainen, J. (2007). Transitive Closures of Binary Relations I (PDF). Prague: School of Mathematics – Physics Charles University. p. 1. Lemma 1.1 (iv). This source refers to asymmetric relations as "strictly antisymmetric".
21. ^ Since neither 5 divides 3, nor 3 divides 5, nor 3=5.
22. ^ Yao, Y.Y.; Wong, S.K.M. (1995). "Generalization of rough sets using relationships between attribute values" (PDF). Proceedings of the 2nd Annual Joint Conference on Information Sciences: 30–33..
23. ^ Joseph G. Rosenstein, Linear orderings, Academic Press, 1982, ISBN 0-12-597680-1, p. 4
24. ^ Tarski, Alfred; Givant, Steven (1987). A formalization of set theory without variables. American Mathematical Society. p. 3. ISBN 0-8218-1041-3.

## References

• M. Kilp, U. Knauer, A.V. Mikhalev, Monoids, Acts and Categories: with Applications to Wreath Products and Graphs, De Gruyter Expositions in Mathematics vol. 29, Walter de Gruyter, 2000, ISBN 3-11-015248-7.
• Gunther Schmidt, 2010. Relational Mathematics. Cambridge University Press, ISBN 978-0-521-76268-7.


text:
(anonymous guest) (logged out)

Sponsored by the Wiki Symposium and the Nuveon GmbH.

This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]
This version has been rejected. After strong opposition and lack of consensus (See Talk.Creole0.7) the originally titled page Creole 1.0 was renamed to 0.7, in order to have another iteration. Creole 1.0 is scheduled for the first of June 2007, see Creole 1.0. Therefore the text below, talking about 1.0, is outdated.

After many long months of cooperation, we have finally reached a point where we can't find any more commonalities. The Creole 0.6 Poll shows that we can't reach consensus anymore. Although in WikiCulture, we would want consensus, when you have developers and users coming together across a wide range of Engines, there are inevitably going to be disagreements. The name Creole was chosen because we knew that the first common language would not be perfect, but good enough to make life easier for everyone using wikis.

Therefore, we think it's time now to submit a Creole 1.0 and not accept any more proposals. Moving forward, proposals now would only complicate WikiCreole, and we would like to have only basic wiki elements in the WikiCreole core and leave advanced elements for Creole Additions. This way the core is useful for wiki developers to integrate mixed edit mode into their wikis, while Creole Additions can be optionally implemented for advanced elements in wikis which need them.

We have used the Creole 0.6 Poll to influence the following decisions:

• We have added an escape character (tilde) back to 1.0.
• Space should not be required after list character, use Hyphen List Markup Proposal
• There should be no explicit monospace font style, but don't define if nowiki is monospaced or not. Omit it and leave this to the developer while recommending the best practice of rendering monospace for in-line and block nowiki.

We are now calling the Creole 0.6 spec to be stable. For those of you who don't find their opinions in those decisions, please remember: Creole was designed to be a common markup, not a standard. Feel free to add a second way of doing things to your parser (see ExtensibleByOmission), which you probably have already done, but please support the least common denominator for the sake of unity and success of this spec. For the Creole 1.0 spec we will move all remaining proposals to be discussed as additions, and add a final word on InterWiki links (this has been forgotten so far, but its markup seems to be the same across most wiki engines).

In conclusion, we would like to propose that the current Creole 0.6 with the additional of InterWiki link syntax be renamed to Creole 1.0 and declared stable. We would also like to propose that there should be no significant changes to the core Creole for the next two years (see Goals). Work will continue on Creole Additions which will provide wiki developers a way to optionally integrate advanced elements of Creole into their wiki engines if desired. If there is no strong opposition, we would like to declare stable Creole 1.0 by 05-May-2007.

-- Christoph Sauer and Chuck Smith

Changes from Creole 0.6:

• more details about disambiguation of hyphens from signatures
• nowiki monospace left to developer with best practice of making nowiki in-line and block to be monospace

## Bold and Italics#

Bold and italic text can be used inside paragraphs, list items and table cells. Links appearing inside bold and/or italic text should also become bold and/or italic. The bold/italic text will end at the end of paragraphs, list items and table cells -- thus it cannot span several of them.

### Bold#

A star (*) is the most used symbol to emphasize text online. Double symbols are generally used in Creole to avoid accidentally parsing text not meant to be parsed. Reasoning

Creole:

 **bold**

Recommended XHTML:

 bold

Sample Output: bold

### Italics#

A slash (/) looks like slanted italics, so it is intuitive and thus easier to remember. Reasoning

Ignore // for italics processing if immediately following http: or ftp:

Creole:

 //italics//

Recommended XHTML:

 italics

Sample Output: italics

Creole:

Bold and italics should //be
able// to cross lines.

But, should //not be...

...able// to cross paragraphs.

Recommended XHTML:

Bold and italics should be
able to cross lines.

But, should not be...

...able to cross paragraphs.

Sample output:

Bold and italics should be able to cross lines.

But, should not be...

...able to cross paragraphs.

### Bold Italics#

Creole:
**//bold italics//**
//**bold italics**//
//This is **also** good.//

Recommended XHTML:

bold italics
bold italics
This is also good.

Sample Output:

bold italics bold italics This is also good.

Unacceptable:

**//bold italics**//
//**bold italics//**

## Lists#

Bold, italics, links, nowiki can be used in list items, but they cannot span several list items. Whitespace is optional before and after the - or # characters. A list element ends at the end of a line, although it can contain line breaks forced with \\. It is recommended to have support for a depth of at least five levels of nesting. Any line that does not start with a - or # (optionally preceded by whitespace) ends the list. Note: a double hyphen should only be parsed as a second-level list when there is a bullet point on the line before or after it to avoid making signatures look like second-level list items.

### Unordered Lists#

It is much easier to view lists with bold in them using a hyphen -, so it does not conflict with the asterisk (*) of bold. The multiple symbol approach for sublists was the first wiki syntax for sublists. Users do not need to count leading spaces like in markups where a sublist level is determined by the number of its leading spaces. Reasoning

Creole:

- Item 1
-- Item 1.1
- Item 2

or:
-Item 1
--Item 1.1
-Item 2

Recommended XHTML:

Item 1

Item 1.1

Item 2

Sample Output:

• Item 1
• Item 1.1
• Item 2

### Ordered Lists#

The number sign (#) is used for ordered lists in most wikis. Reasoning

Creole:

# Item 1
## Item 1.1
# Item 2

or:
#Item 1
##Item 1.1
#Item 2

Recommended XHTML:

Item 1

Item 1.1

Item 2

Sample Output:

1. Item 1
1. Item 1.1
2. Item 2

Using equal signs (=) is the most popular wiki header markup. Since there are more equal signs for smaller headers, subheaders will become more indented making it easier to get a visual overview from the markup alone. Closing equal signs are optional, making Creole more flexible since many wiki engines do not require them. Reasoning

Only three different sized levels of headings are required. Closing (right-side) equal signs are optional, don't need to be balanced and don't impact the kind of heading generated. Whitespace is not allowed before the left-side equal signs. Only whitespace characters are permitted after the closing equal signs. No markup has to be parsed within headings.

Note: In Creole 0.3 and earlier, the level one headings were not included, since many wiki engines consider the title of a wiki page to be H1 (see Wikipedia:Wikipedia:Manual of Style (headings)).

Creole:

= Level 1 (largest) =
== Level 2 ==
=== Level 3 ===
==== Level 4 ====
===== Level 5 =====
====== Level 6 ======
=== Also level 3
=== Also level 3 =
=== Also level 3 ==
=== **not** //parsed// ===

Recommended XHTML:

Level 1 (largest)

Level 2

Level 3

Level 4

Level 5

Level 6

Also level 3

Also level 3

Also level 3

**not** //parsed//

## Links - Internal, External and Interwiki#

Almost all wikis use square brackets ([[]]) to make links. Using double square brackets allows single square brackets to be used freely without worry of turning them into links. Reasoning

Links can appear in paragraphs (also inside bold and italic text), list items and table cells. The links are bold or italic if they are part of bold or italic text. At least images inside links must be supported. Parsing other markup within a link is not required (optional).

Free-standing urls should be detected and turned into links. Single punctuation characters (,.?!:;"') at the end of urls should not be considered part of the url.

If your wiki supports Interwiki links, links to other wikis should be made by putting the wiki name, then a colon in front of the page title. For example, linking to [[WikiCreole:Creole1.0]] would link to the Creole spec on this WikiCreole wiki.

Creole:

[[link]]
[[MyBigPage|Go to my page]]
[[http://www.wikicreole.org/]]
[[http://www.wikicreole.org/|Visit the WikiCreole website]]
[[Weird Stuff|**Weird** //Stuff//]]
[[Ohana:WikiFamily]]

Recommended XHTML:

link
Go to my page
http://www.wikicreole.org/
Visit the WikiCreole website
**Weird** //Stuff//
Ohana:WikiFamily

Sample Output:

## Paragraphs#

No markup tags should be necessary to start a new paragraph. Reasoning

One or more blank lines end paragraphs. A list, table or preformatted block end paragraphs too.

Creole:

This is my text.

This is more text.

Recommended XHTML:

This is my text.

This is more text.

Sample Output: This is my text.

This is more text.

## Line breaks#

blog-style vs. wiki-style
There was a long discussion whether to use blog-style or wiki-style (legacy-style) line breaks. We decided to change the original blog-style line break recommendation (treat linebreaks as line breaks) from Creole 0.3 to the wiki-style linebreaks recommendation. Wikis must support forced line break syntax \\ .

We encourage engine developers that have already implemented the Creole 0.3 style (blog-style) line breaks not to throw away their implementation, but to add an option so that administrators can choose in which mode to run their installation. This way we hope to gain more experience with blog-style line breaks. In a blog-style line break mode, the forced line break syntax must be supported, so that line breaks will properly migrate when people copy text from a wiki with forced line break characters. Reasoning

 \\
(wiki-style) for line breaks.

Creole:

This is the first line,\\and this is the second.

Recommended XHTML:

This is the first line,

and this is the second.

Sample Output:

This is the first line,
and this is the second.

Creole:

- This is a single list item
followed by a paragraph?

Recommended XHTML:

This is a single list item

followed by a paragraph

Sample Output:

• This is a single list item
followed by a paragraph

## Nowiki (Preformatted)#

There must be a way for users to enter text which will not be formatted by the wiki engine. Triple curly brackets ({{{}}}) were chosen due to their visibility and unlikeliness to be in the "code" itself. Reasoning

This works inline or as a block. No wiki markup is interpreted between these characters. As a block, the three curly braces should be on one line by itself to open and another line of three curly braces should be on a line by itself to close. We strongly recommend displaying nowiki text as monospace, but this is not required (also see: Proportional Font Nowiki Proposal).

Creole:

{{{
//This// does **not** get [[formatted]]
}}}

Recommended XHTML:

//This// does **not** get [[formatted]]

Sample Output:

//This// does **not** get [[formatted]]

## Horizontal Rule#

All non-WYSIWYG wikis use hyphens (----) to denote horizontal rules. Most wikis require four. Reasoning

Whitespace is optional before and after the hyphens, but no whitespace is allowed between them. The four hyphens must be the only characters (other than whitespace) on that line.

Creole:

 ----
Recommended XHTML:

## Image (inline)#

Images are a common enough element on modern wiki pages to deserve their own markup. An exclamation point ! was not chosen as they are used by many wikis for emphasis. A prefix like "Image:" was not chosen because it's not obvious or friendly for non-English users. Wikis are still free to use prefixes in the image names if they are needed for denoting namespace, like in MediaWiki. Reasoning

Creole:

 {{myimage.png|this is my image}}

Recommended XHTML:

## Tables#

Most wikis use single or double pipes to separate table cells. Single pipes (|) allow better use of space and are faster to type than double pipes since pipes are not usually needed in table cells. Reasoning

All cells are separated by single pipes. The ending pipe is optional. You can embed links, bold, italics, monospace, line breaks and preformatted/nowiki in table cells. Equal sign directly following pipe defines a header. Headers can be arranged horizontally or vertically. Comparison details found on List Of Table Markups

Creole:

|=Heading Col 1 |=Heading Col 2 |
|Cell 1.1 |Two lines\\in Cell 1.2 |
|Cell 2.1 |Cell 2.2 |

Recommended XHTML:

Cell 1.1
Two lines\\in Cell 1.2

Cell 2.1
Cell 2.2

Sample output:

Cell 1.1 Two lines
in Cell 1.2
Cell 2.1 Cell 2.2

## Escape Character#

Users should be able to escape markup characters (or all non-alphanumeric characters) with a special character. It's often faster to type and more readable than using nowiki (3+3 curly braces). In order to allow spaces in front of lists, which is a quite common practice in wiki engines, it should be a escape character other than space. This way, stars, slashes and other markup characters, when found in the original text, can be easily escaped, to be rendered as themselves. Reasoning

It is often troublesome to use the nowiki in-line to display symbols of wiki syntax, so it would be useful to have an escape character that could be put before wiki syntax to prevent it from being interpreted. The tilde was chosen not to conflict with line breaks and because it is a very infrequently used character. It is not generally easy to type, but it will also not need to be used often, so in this sense it is also suitable.

The escape character only escapes in certain combinations. This means that e.g. the tilde in this use case is displayed as tilde and not escaped. It would certainly never escape if followed by a space or an alphanumeric character.

http://stud.hs-heilbronn.de/~someone

Escape characters only trigger if you use it in combination with the occurrence of a character that has special meaning in creole and would otherwise be rendered as markup. For example if you use "tilde + equal sign as first characters in a line" it will escape the equal sign and display it as such because otherwise it would be rendered as heading.

=Heading
~=Line starting with equal sign, this displays a normal tilde: ~

If an escape character is only used in certain combinations we have a minimum of collisions with existing markup. For example if an wiki uses tilde as normal markup, it would not collide with e.g.

~=This is a heading
~this is subscript in certain wikis~
~~=This is a sentence with a tilde and an equal sign at the beginning... (tilde escapes itself)

Here's a complete list that would cause the escape character (e.g. tilde) to trigger escaping of the following character combinations. This can be extended as need be. Note also that an escape character can be escaped by putting a space after it, since a space cannot be escaped.

Escapes Markup      Combination Constraint              Example:
==============      ==========================          =========
Bold                Anywhere                            ~**
Italics             Anywhere                            ~//
Unordered Lists     Hyphen, first chars in line         ~-
Ordered Lists       First chars in line                 ~#
Headings            Equal signs, first chars in line    ~=
Line Breaks         Anywhere                            ~\\
Horizontal Line     First chars in line                 ~----
Image Open          Anywhere                            ~{{
Image Close         Anywhere                            ~}}
Table Open          First chars in line                 ~| this is | not a table
Inside Tables       Pipe used within a table cell       | x~|y |
Escaping Escape     Anywhere                            ~~
Escaping Escape     Anywhere                            ~<space>
Nowiki Open         First chars in line                 ~{{{
Nowiki Close        First chars in line                 ~}}}

So, for example, this markup:

{{{
int main(int argc, char *argv[]) {
if argc>0 {
if argc<=1 {
--argc;
}}}

will produce this result:

int main(int argc, char *argv[]) {
if argc>0 {
if argc<=1 {
--argc;
}}}

Creole:

Some examples of markup are: {{{** this ** }}}

Recommended XHTML:

Some examples of markup are: <tt>** this **</tt>

Sample output:

Some examples of markup are: ** this **

## Placeholder#

This is the only new markup introduced in Creole. Few wikis use angle brackets (<<>>) for markup and it is easy to type on most international keyboards. This was mainly developed due to MediaWiki's extensive use of special characters making it practically impossible to implement Mixed Creole mode. Reasoning

When there is something advanced, a placeholder will show up, so users will not be confused seeing more than one syntax. (optional for wiki developers)

Creole:

 <<x>>

## Mixed syntax examples#

Creole:
//[[Important page|this link is italicized]]//
**[[Important page]]**
//**[[Important page]]**//

Recommended XHTML:

this link is italicized
Important page
Important page

Sample Output: this link is italicized
Important page
Important page

### Bold, Italics, Links, Pre in Lists#

Creole:
- **bold** item
- //italic// item
# item about a [[certain page]]
# {{{ //this// is **not** [[processed]] }}}

Recommended XHTML:

bold item

italic item

item about a certain page

<tt>//this// is **not** [[processed]]</tt>

Sample Output:

• bold item
• italic item
1. item about a certain page
2. //this// is **not** [[processed]]


text:
# Anoucement Gate

#### Skitty

##### Member
In my youth group we have a bouncer that stands out side to greet the parents of the youth before the kids leave. How things work is that he will get the name of the kid from the parent then he will comunicate to a leader in the building through a two way. Then she will anounce it over the PA that is currently playing music. Nobody likes this process. He was asking me if there is any way for us to purchase a mic for him to wear and a device that would cut the music signal long enough for him to make an annoucement over the PA without anyone being there to mess with the mixer. So he is wanting an automatic gate of some sort. Does anyone know of anything that does this?

#### koncept

##### Active Member
its done through relays and thats all i know, if some body does know the type and how to put one in i would be intereted for the applications at school and other places

#### BNBSound

##### Active Member
You can do this with almost any compressor. Pick up an Alessis 3630 or Behringer Composer on eBay for around $40 or$50.

Set it up to run stereo linked and run each channel of your music through it. Then split the input from a wireless headset that your bouncer is wearing. Run one side through a regular channel to be put out through the PA, and the other one plugs into that side chain jack. When he talks, half his signal triggers the comp to lower the music and the other half goes out over the speakers.

Replies
0
Views
243
Replies
28
Views
3K
Replies
0
Views
279
Replies
19
Views
4K


text:
lilypond-devel
[Top][All Lists]

## Re: R\fermata: How to build a markup in C++?

 From: Malte Meyn Subject: Re: R\fermata: How to build a markup in C++? Date: Tue, 16 Apr 2019 13:31:52 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

```

Am 16.04.19 um 13:21 schrieb Neil Puttock:
```
```Hi Malte,

On Mon, 15 Apr 2019 at 10:55, Malte Meyn <address@hidden> wrote:

```
```Are there any other ideas how the R\fermata thing could be done?
```
```
Check out scm/lily-syntax-constructors.scm, where there's a
constructor for MM rests:

Cheers,
Neil
```
```
```
Thanks for the hint! I had already seen that (only then I realised that \fermata already creates a MultiMeasureTextEvent and MultiMeasureRestText grob that just has an 'articulation-type instead of 'text property). But your hint made me look again at that place. Maybe I could build the 'text from the 'articulation easier in Scheme than in C++ (i. e. change the definition of script-to-mmrest-text so that it gives ‘music’ a 'text property before calling make-music).
```

```


text:
# PDE's as minimisation problems

I am reading through Chapter 8 of Brezis. Particularly Section 8.4, which deals with some examples of boundary value problems on an interval. For the most part I understand the steps in the proofs contained in 8.4, however I am lacking the motivation and reasoning behind constructing the proofs as they are. I refer to Proposition 8.17 as an example.

Consider the problem, \begin{align}(21)\qquad\begin{cases} -u''+u=f\quad\text{on }I=(0,1),\\\ u'(0)=u'(1)=0. \end{cases}\end{align}

Proposition 8.17

Given $$f\in L^{2}(I)$$ there exists a unique function $$u\in H^{2}(I)$$ satisfying (21). Furthermore, $$u$$ is obtained by, \begin{align} \min_{v\in H^{1}(I)}\bigg(\frac{1}{2}\int_{I}(v'^{2}+v^{2})-\int_{I}fv\bigg) \end{align} If, in addition, $$f\in C(\overline{I})$$, then $$u\in C^{2}(\overline{I})$$.

Proof. If $$u$$ is a classical solution of (21) we have, \begin{align} (22)\qquad\int_{I}u'v'+\int_{I}uv=\int_{I}fv\quad\forall v\in H^{1}(I). \end{align} We use $$H^{1}(I)$$ as our function space: there is no point in working in $$H^{1}_{0}$$ as above since $$u(0)$$ and $$u(1)$$ are a priori unkonwn. We apply the Lax_Milgram theorem with the bilinear form $$a(u,v)=\int_{I}u'v'+\int_{I}uv$$ and the linear function $$\varphi:v\mapsto\int_{I}fv$$. In this way we obtain a unique function $$u\in H^{2}(I)$$. Using (22) once more we obtain, \begin{align} (23)\qquad\int_{I}(-u''+u-f)v+u'(1)v(1)-u'(0)v(0)=0\quad\forall v\in H^{1}(I). \end{align} In (23) begin by choosing $$v\in H^{1}_{0}$$ and obtain $$-u''+u=f$$ a.e Returning to (23), there remains, \begin{align} u'(1)v(1)-u'(0)v(0)=0\quad\forall v\in H^{1}(I). \end{align} Since $$v(0)$$ and $$v(1)$$ are arbitrary, we deduce that $$u'(0)=u'(1)=0$$. $$\blacksquare$$

My questions are:

1. Why do we begin by assuming $$u$$ is a classical solution if that is a result of the proposition?

2. Once we show that there exists a weak solution $$u\in H^{2}(I)$$ what are we aiming to do in the second part of the proof? i.e. from (23) onwards. By this I mean, we have showed the same proposition for the same PDE with homogeneous Dirichlet conditions. So what stops me from showing this same property in that proposition as opposed to this proposition (if you have the text I am referring to Proposition 8.15).

• Giving this question a bump. If anyone can help that would be greatly appreciated. – Zeta-Squared Jul 22 at 8:58


text:
# Relative scale in SfM

I'm using monocular visual odometry. As in this case absolute scale can't be recovered, we rather compute relative scale for subsequent transformations as in this tutorial

To do this, triple matches across three frames are required. We then triangulate two $3D$ points $X_{m}$ and $X_{n}$ from images $\{i,i+1\}$ and $\{i-1,i\}$ then the relative scale can be determined from the distance ratio between point pairs in subsequent image pairs as follows:

$r=\frac{\parallel X_{m,\{i,i+1\}}-X_{n,\{i,i+1\}}\parallel}{\parallel X_{m,\{i-1,i\}}-X_{n,\{i-1,i\}}\parallel}$

My question concernes the coordinate system of the triangulated $3D$ points, the points have to be expressed in the coordinate system of the first, second or third frame or it dosen't matter as we are using the norm?

The triangulation method that I'm using outputs a $3D$ point expressed in the first viewpoint. How to convert it to another viewpoint?

## 1 Answer

The answer simply is, it does not really matter because you're using the norm. The scale is determined by the actual translation and rotation between two cameras (which in case of monocular odometry are two views from the same calibrated camera). This rotation and translation information is contained in the essential matrix (or fundamental matrix) which has a scale ambiguity.

Another point I'd like to mention is, triangulation using monocular images is seldom very accurate. So if your objective is to determine the scale of subsequent images to generate a trajectory, I suggest taking a median of many ratios between many corresponding points, because it will work much better than randomly selecting two points and calculating r.

To express your 3D point to another viewpoint, use bundle adjustment.


text:
# Automatic theorem prover for first-order logic versus model checker

What's the formal difference between a model checker, and an automated theorem prover for first-order logic, i.e. something like Meson/Metis/Sledgehammer/Vampire/E? Link to a clear discussion of the difference is preferred.

• Do you understand the difference between the satisfaction relation and the validity relation for logical formulae? – Martin Berger Apr 17 '20 at 7:14
• Satisfiability, true in 1 interpretation compared to validity, true in all interpretations? – Nift Apr 17 '20 at 18:40
• Not satisfiability, but satisfaction. A model checker takes a formula and a model, and checks whether the formula holds in that particular model. That’s completely different from checking validity in all models. – Emil Jeřábek Apr 18 '20 at 6:43

Given the statement $$p \wedge q$$ we can ask whether it is true in the model $$\{p=\top,q=\bot\}$$ (model checking) or we can ask whether it is true in all models (theorem proving). We can also ask whether it is true in some models (satisfiability checking).


text:
## Back To School '17: 🅱aram🅱e

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

d needs help editing his assignment for English class. He forgot to use periods, and needs your help to fix the errors in his assignment.

If there is a word that starts with a capital letter, then there should be a period in front of the word before it. Also, the text should end with a period.

#### Input Specification

The input will consist of a series of words. There will be at least 1 word, and at most 50.

The text will only contain alphabetical characters and spaces. Words will be separated by a single space, and are all on a single line.

#### Output Specification

Output the text after you have edited it by placing all the periods where they are needed to be placed.

#### Sample Input 1

Justin was infuriated with him for making problem four systested Justin could not do anything about it

#### Sample Output 1

Justin was infuriated with him for making problem four systested. Justin could not do anything about it.

#### Sample Input 2

Programming is a lot of fun It should be introduced to children from a young age Computer Science is our future

#### Sample Output 2

Programming is a lot of fun. It should be introduced to children from a young age. Computer. Science is our future.

#### Sample Input 3

I want some Boneless Pizza

#### Sample Output 3

I want some. Boneless. Pizza.

• commented on March 5, 2021, 8:14 p.m.

haha yes comic sans

• commented on March 18, 2020, 1:14 p.m.

comic sans

• commented on April 6, 2019, 2:36 p.m.

petition to bring comic sans to the rest of the site

• commented on July 1, 2018, 8:46 p.m. edited

Paperless computers... I guess...

• commented on March 4, 2018, 8:54 a.m.

• commented on Nov. 16, 2017, 3:05 p.m.

Boneless Pizza?

• commented on Feb. 7, 2018, 4:12 p.m.

If it ain't got bones in it, then it's BONELESS

• commented on Feb. 8, 2018, 7:48 p.m.

But why waste time writing boneless when all pizzas don't have bones?

• commented on Feb. 8, 2018, 8:22 p.m. edit 2
• commented on Feb. 13, 2021, 10:30 a.m.

oh no...

• commented on Nov. 16, 2017, 7:55 p.m.

Seedless Bananas

• commented on Feb. 7, 2018, 4:08 p.m.

juiceless nuts

• commented on Sept. 9, 2018, 8:51 p.m. edited

Faceless Hair

• commented on Oct. 28, 2018, 10:27 a.m. edit 4

This comment is hidden due to too much negative feedback. Click here to view it.


text:
## anonymous one year ago Help with differentiation Please! Problem Below

1. anonymous

If$f(x) = x^2, x \le1$ and $f(x)=2x, x>1$ is f differentiable at 1?

2. anonymous

wait though, it isn't continuous at 1

3. marigirl

your write cuz it looks like this |dw:1444166725638:dw| IT is continuous but not differentable at x=1 sorry if i confused u before

4. anonymous

that isnt continuous

5. anonymous

also why is it not differentiable

6. marigirl

Limits: usually we look at a specific value when the graph approaches a number that we are after. A limit won't exist when we get different solutions from above and below graph (See my picture)

7. marigirl

|dw:1444167201542:dw|

8. marigirl

So when we approach the discontinuity form above and below point x=1 the graph no longer approaches the same value

9. marigirl

same y value*

10. anonymous

is this valid:$f'(1)=\lim_{h \rightarrow 0^{-}}\frac{ (1+h)^2-(1)^2 }{ h }=2$ and$f'(1)=\lim_{h \rightarrow 0^+}\frac{2(1+h)+2(1)}{h}=2$

11. anonymous

because the limits are the same, its just that the function isn't continuous

12. marigirl

@surjithayer

13. anonymous

It is Continuous because the x value exists at all points. x=1 is subsidized for the leap. just because there is a leap doesn't make it not continuous.

14. anonymous

that isn't the definition of continuity

15. anonymous

limits from both sides have to be the same

16. anonymous

a function f is said to be continuous at x=a 1. Limit exists Means left hand limit =Right hand limit. 2. f(x)=f(a) Here limit does not exist at x=1 so it is not continuous at x=1 so it is not differentiable at x=1